开发者

Could anyone pls convert this unixtime stamp in php?

开发者 https://www.devze.com 2023-02-04 03:28 出处:网络
I am struggling with this unixtimestamp and just cant find a correct format Here is the stamp: 1295058844

I am struggling with this unixtimestamp and just cant find a correct format

Here is the stamp:

1295058844

And here is 开发者_运维问答the result i want to achive:

01/14/2011 at 21:34 EST

And here is my almost correct but no luck code:

$start_unixtime = '1295058844';
date('m/d/Y \a\t H:i', intval($start_unixtime));

Basically i want EST time format, hope someone could help and sorry for such stupid question.

Thank you.


You need to use the date_default_timezone_set function before you call date.

date_default_timezone_set("America/New_York");

List of possible choices.
http://us2.php.net/manual/en/timezones.php


No need for intval.

date_default_timezone_set("TIMEZONENAME");
$start_unixtime = '1295058844';
echo date('m/d/Y \a\t H:i', $start_unixtime);


Maybe to get your "at" into there: date('m/d/Y',$x).' at '.date('H:i',$x)

After that I never could remember the codes, I tend to look them up every time.

0

精彩评论

暂无评论...
验证码 换一张
取 消