markvaughn2006 Posted December 22, 2010 Share Posted December 22, 2010 sorry, I know this is simple, but stuck on it... how would one go about converting 1/21/11 to a UNIX timestamp, something like 1293035229? and while we are at it, how to convert 1293035229 to 1/21/11 ? (i know the timestamp is wrong, just for example) THX!!!!! Link to comment https://forums.phpfreaks.com/topic/222417-convert-a-date-to-unix-timestamp/ Share on other sites More sharing options...
micah1701 Posted December 22, 2010 Share Posted December 22, 2010 <?php $not_unix = "12/01/01"; $unix = strtotime($not_unix); echo $unix; ?> edit: just be careful of some traps like "MM/DD/YY" vs "YY/MM/DD" or "mm/dd/yy" vs "mm-dd-yy" check out the docs and comments at php.net/strtotime Link to comment https://forums.phpfreaks.com/topic/222417-convert-a-date-to-unix-timestamp/#findComment-1150451 Share on other sites More sharing options...
requinix Posted December 22, 2010 Share Posted December 22, 2010 ...and date goes in the opposite direction. Link to comment https://forums.phpfreaks.com/topic/222417-convert-a-date-to-unix-timestamp/#findComment-1150466 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.