HI
can any one please help me how to convert timestamp to IST
jtime = 2014-07-23 02:41:05 to Date H:i:s am/pm formate
Use DateTime
and DateTimeZone
// i'm assuming this is server time?
$jtime = "2014-07-23 02:41:05";
// initialize a DateTime object
$time = new DateTime($jtime);
// initialize a DateTimeZone object to get the new timezoe
$ist_zone = new DateTimeZone('Asia/Kolkata');
// set timezone
$time->setTimezone($ist_zone);
// if you're going to use am/pm, use "h" instead of "H" for 12-hour time
echo $time->format('Y-m-d h:i:s a'); // returns 2014-07-23 12:11:05 pm
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.