Created
February 16, 2017 05:52
-
-
Save phpfiddle/f5406f95af029bbed211d66051ce6cb2 to your computer and use it in GitHub Desktop.
[ Posted by Bilalsardar ] simple code for converting time to unix time
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$timezone = "Asia/Karachi"; | |
date_default_timezone_set($timezone); | |
$date = "2017-02-16"; | |
$from_time = "8:00 AM"; | |
$to_time = "10:00 AM"; | |
$fr_time = date("H:i:s", strtotime($from_time)); | |
$t_time = date("H:i:s", strtotime($to_time)); | |
$from_gmt = $date . " " . $fr_time . " " . "GMT+5"; | |
$from_unix = strtotime($from_gmt) . "000"; | |
$to_gmt = $date . " " . $t_time . " " . "GMT+5"; | |
$to_unix = strtotime($to_gmt) . "000"; | |
echo $from_unix; | |
echo "<br>"; | |
echo $to_unix; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment