Monday, 15 April 2013

datetime - PHP Converting a date to a timestamp -


How do I change "9/7/2009" in a timestamp, such as time () ? Are you strtotime () ?

, / P>

  $ time = strotom (' 9/7/2009 '); Echo $ time; // 1252278000  

This will accept a format of mm / dd / yyyy, so try not to do it with a UK-style DD / MM / Yay date.

To the other side, use

  $ date = date ('n / j / y', $ time); Echo $ date; // 9/7/2009  

No comments:

Post a Comment