UNIX timestamp to regular time [SOLVED]

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
mikeeeeeeey
Forum Contributor
Posts: 130
Joined: Mon Jul 03, 2006 4:17 am
Location: Huddersfield, UK

UNIX timestamp to regular time [SOLVED]

Post by mikeeeeeeey »

Hi guys (again)

I've scoured the web and can't find anything about any preset function to covert POSIX to a more meaniful format which I can take apart.

Anyone know of any? or have any ideas on how to do it?

Thanks in advance :D
Last edited by mikeeeeeeey on Thu Apr 05, 2007 8:16 am, edited 1 time in total.
mentor
Forum Contributor
Posts: 100
Joined: Sun Mar 11, 2007 11:10 am
Location: Pakistan

Post by mentor »

Did you try date()
User avatar
mikeeeeeeey
Forum Contributor
Posts: 130
Joined: Mon Jul 03, 2006 4:17 am
Location: Huddersfield, UK

Post by mikeeeeeeey »

I've checked it out, but I can't find anything about going from POSIX to the time.

It all seems to be from the time to POSIX. :(
mentor
Forum Contributor
Posts: 100
Joined: Sun Mar 11, 2007 11:10 am
Location: Pakistan

Post by mentor »

You can pass 2 parameters to date() function, one is format and 2nd is timestamp. Check the manual again.
Try something like

Code: Select all

echo date("F j, Y, g:i a", $timestamp);
User avatar
mikeeeeeeey
Forum Contributor
Posts: 130
Joined: Mon Jul 03, 2006 4:17 am
Location: Huddersfield, UK

Post by mikeeeeeeey »

ahh nice one,

Code: Select all

date("F j, Y, g:i a", filemtime($file))
that's the one, thanks mentor :D
Post Reply