Welcome Guest, Not a member yet? Register   Sign In
listing news and events problem
#1

[eluser]Bigil Michael[/eluser]
i want to list news and events like this manner


june 2011
may 2011
april 2011
.
.
.
.
.
july 2010


i dont know how to print months like this can anyone help me??
#2

[eluser]vitoco[/eluser]
suposing that your date stored in $date , you can transform that to time using strtotime

http://www.php.net/manual/en/datetime.formats.date.php

in one of the formats accepted, then use the time resulting as second parameter for date() function, and format to using first parameter

http://php.net/manual/en/function.date.php

example
Code:
$date = '2011-01-01' ;
echo date('F Y' , strtotime( $date ) );

Saludos
#3

[eluser]Bigil Michael[/eluser]
my aim is not like that

i have date like this in my table

2011-06-01
2011-06-05
2011-06-11
2011-06-15

2011-07-01
2011-07-05
2011-07-11
2011-07-15

i want to print the date like this
june 2011
july 2011

if any date in a month is present then i want to print that month.
i think now you got the problem

can anyone solve my problem??
#4

[eluser]jmadsen[/eluser]
so follow the link vitoco posted: http://php.net/manual/en/function.date.php

and put the parameters in the format that match what you are after.


Code:
$date = '2011-01-01' ;
echo date('M Y' , strtotime( $date ) );

After 173 posts, you should start to make an effort to look some things up on your own and try them before calling for help.
#5

[eluser]vitoco[/eluser]
I've already solve your problem, and if that isn't enough or you don't get it...well...




Theme © iAndrew 2016 - Forum software by © MyBB