Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Array
- (
- [0] => Array
- (
- [0] => Array
- (
- [hour] => 5
- [minute] => 0
- [period] => AM
- )
- [1] => Array
- (
- [hour] => 5
- [minute] => 0
- [period] => PM
- )
- [2] => Array
- (
- [day_off] => 0
- )
- )
- )
- $timezone = new DateTimeZone("Asia/Kolkata"); //Converting GMT to IST.
- $startTime = new DateTime();
- $startTime->setTime($Array[1][0]["hour"], $Array[1][0]["minute"]);
- $startTime->setTimezone($timezone);
- $startTime->format('h:i a'); //output 10:30 PM // Should be 10:30 AM
- $endTime = new DateTime();
- $endTime->setTime($Array[1][1]["hour"], $Array[1][1]["minute"]);
- $endTime->setTimezone($timezone);
- $endTime->format('h:i a'); //output 10:30 PM //ok
- So My $startTime and $endTime both has the same value of `10:30` PM but I want the startTime to have value of `10:00 AM`because its period was `AM` in the array.
Add Comment
Please, Sign In to add comment