Hey, I'm just wondering how to convert a numerical date into text format in PHP
Example change
06.04.2010 to say April 6th 2010
Is t开发者_开发技巧here any function already made?
Check out these PHP functions, used together I think you will get what you're looking for:
- strtotime
- date
i.e.:
$mydate = strtotime('06.04.2010');
echo date('F jS Y', $mydate);
Note that strtotime() may be difficult with non-US format dates at times (in particular dates of DD/MM/YYYY formats, although it's fine with YYYY-MM-DD); if you're using PHP 5.3, you will almost certainly have better results using something like the DateTime class, which allows you to specify what format the date is in.
精彩评论