Jump to content

Date format


xionhack

Recommended Posts

Hello,

 

TheLoveableMonty explained date/time format option. So if you need to apply it you should use the following syntax:

date("format string", datevalue);

 

But this will not work in your case as you get string-date from your database. You need to convert it to timestamp in order to use date format option.

 

 

This would be solution for you:

$my_date = strtotime($my_date);
echo date('F \t\h\e jS o' , $my_date);

 

Explanation of strtotime function:

it parse about any English textual datetime description into a Unix timestamp (PHP 4, PHP 5)

int strtotime ( string time [, int now] );

 

Good luck ;)

Link to comment
https://forums.phpfreaks.com/topic/144026-date-format/#findComment-755751
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.