how can i convert unix time o time in php?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
pelegk2
Forum Regular
Posts: 633
Joined: Thu Nov 27, 2003 5:02 am
Location: Israel - the best place to live in after heaven
Contact:

how can i convert unix time o time in php?

Post by pelegk2 »

what is the fast way?
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

what is the difference between a unix timestamp and php date anyway?
i was not aware that php has a date type? (http://www.php.net/manual/en/language.types.php)
User avatar
pelegk2
Forum Regular
Posts: 633
Joined: Thu Nov 27, 2003 5:02 am
Location: Israel - the best place to live in after heaven
Contact:

he diffrence is that for example

Post by pelegk2 »

if i have a time in unixtime likethis :
1104616800
and i want to convert it using php to a date/timevalue i dont havea ready made function!

the link to the types dosent help
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

yes, you do have "ready made function" .. it's called almost any of the time related functions. date(), strftime(), etc.. all can take a timestamp argument.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

I don't understand what you mean. So you have a unix timestamp... which PHP handles nicely with it's date() function. And you want to get what?

Code: Select all

date("d/m/Y G:i:s", $timestamp);
Am I being dumb or is that what you mean?

EDIT | Oops... I see my point was already made by feyd. Took me 10 mins to write that answer cos I keep getting jobs to do :-(
User avatar
pelegk2
Forum Regular
Posts: 633
Joined: Thu Nov 27, 2003 5:02 am
Location: Israel - the best place to live in after heaven
Contact:

mmmmmmmmmm i see know

Post by pelegk2 »

thnaks you both
Post Reply