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
intellivision
Forum Commoner
Posts: 83 Joined: Mon Aug 22, 2005 1:25 am
Location: Orbit
Post
by intellivision » Wed Nov 19, 2008 5:08 pm
My server's time is dead on (Cent OS via Plesk). But when I do a
Code: Select all
<?php echo(date('m-d-Y h:s',time())); ?>
I get a time that's about 24 minutes in the future.
Any ideas?
intellivision
Forum Commoner
Posts: 83 Joined: Mon Aug 22, 2005 1:25 am
Location: Orbit
Post
by intellivision » Wed Nov 19, 2008 5:13 pm
Whoa... I just ran that code again four times in one minute and got the following:
11-19-2008 04:01
11-19-2008 04:45
11-19-2008 04:59
11-19-2008 04:25
So strike the bit about 24 minutes. My PHP time is drunk.
andyhoneycutt
Forum Contributor
Posts: 468 Joined: Wed Aug 27, 2008 10:02 am
Location: Idaho Falls
Post
by andyhoneycutt » Wed Nov 19, 2008 5:14 pm
Your date formatting is off, try:
Code: Select all
// Wrong (month, day, year, hours, seconds:
echo(date('m-d-Y [color=#FF0000]h:s[/color]',time()));
// Right: (month, day, year, hours, minutes:
echo(date('m-d-Y [color=#00BF00]h:i[/color]',time()));
-Andy
intellivision
Forum Commoner
Posts: 83 Joined: Mon Aug 22, 2005 1:25 am
Location: Orbit
Post
by intellivision » Wed Nov 19, 2008 5:23 pm
Andy, thanks!
I think I was randomizing or something. Oy vey. Gracias.
andyhoneycutt
Forum Contributor
Posts: 468 Joined: Wed Aug 27, 2008 10:02 am
Location: Idaho Falls
Post
by andyhoneycutt » Wed Nov 19, 2008 5:24 pm
No problem, next time instead of blaming your php for being drunk, you might want to take a breathalyzer youself