Convert m-d-Y to unix format
Moderator: General Moderators
Convert m-d-Y to unix format
Does anyone know how to convert 08-15-2008 (m-d-Y) format into a unix timestamp for querying in php
Re: Convert m-d-Y to unix format
Can't you use the maketime function and just convert it over? I'm pretty sure there's a function that can give you the date in unix format. Check the php manual: http://us.php.net/manual/en/function.date.php
It should be your new best friend!!
It should be your new best friend!!
Re: Convert m-d-Y to unix format
Everything seems to be formatting a unix timestamp... I want to do the opposite.. take a formatted date and produce a unix timestamp.. can't seem to find it.
Re: Convert m-d-Y to unix format
time returns unix time stamp, http://www.php.net/time
- EverLearning
- Forum Contributor
- Posts: 282
- Joined: Sat Feb 23, 2008 3:49 am
- Location: Niš, Serbia
Re: Convert m-d-Y to unix format
Code: Select all
$date = "08-15-2008";
list($month, $day, $year) = explode("-", $date);
$date = mktime(0, 0, 0, $month, $day, $year);