开发者

Numerical Date To Text Date PHP

开发者 https://www.devze.com 2022-12-25 16:49 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号