Reputation: 1449
I need to check the current time with a respective time fixed by the admin, if the current time crosses the respective time, will update status
1) How can i convert the respective date to unix timestamp ?
TIME STAMP: 1267285500 for DATE: 2 / 27 / 2010 @ 9:45:0
so that i can compare the unix timestamps of the current time and respective time and update the status
2) Is there any easy way that i can acheive this task ?
Thank You,
Upvotes: 0
Views: 726
Reputation: 8923
strptime('2 / 27 / 2010 @ 9:45:0', '%m / %e / %Y @ %T'); // This might not work.
Whoever decided that they where not going to use leading zeros kinda screwed you on this one. You might have to parse the date some more to get a full result like this:
list($date, $time) = explode(' @ ', '2 / 27 / 2010 @ 9:45:0');
list($month, $day, $year) = explode(' / ', $date);
list($hour, $minute, $second) = explode(':', $time);
$unixtime = mktime($hour, $minute, $second, $month, $day, $year);
Upvotes: 0