I have a code that gives me a unix time ie)1277851200
How would i be able to convert that to x minutes x seconds and so on. (real time)

Recommended Answers

$timestamp = 1277851200; // as your example
echo date("h:i:s",$timestamp);
Jump to Post

All 4 Replies

I have a code that gives me a unix time ie)1277851200
How would i be able to convert that to x minutes x seconds and so on. (real time)

Have you tried

date ( string $format [, int $timestamp ] )

? Refer to date() in the php docs at php.net.

$timestamp = 1277851200; // as your example
echo date("h:i:s",$timestamp);

$unixTime = 1309956169;
echo date("d-m-Y @ h:i:s",$unixTime);


thanks,
Muhammad Jawad

$timestamp = 1277851200; // as your example
echo date("h:i:s",$timestamp);

I also go with this suggestion. Personally I have used this one and works perfect. Keep sharing such discussions in future.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.