date() & time()

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:

date() & time()

Post by pelegk2 »

what execlly does the second part of the date() means :

Code: Select all

date("m/d/y 23:59:59",time()+60 * 60 * 24)
thnaks in advance
peleg
burzvingion
Forum Newbie
Posts: 11
Joined: Sun Apr 18, 2004 2:30 pm

its in the manual but...

Post by burzvingion »

Code: Select all

date($format, $timestamp)
$format is a string with how you want the date to be returned. I think you know that

$timestamp in a unix timestamp of the date you want. to return today's date you can leave off this parameter. you'll prolly want to use mktime() to make a timestamp to use here.

All this is in the php manual with plenty of examples. I suggest going there first before you ask it on a forum from now on. (exact page in manual: http://us4.php.net/manual/en/function.date.php)

glad i could help tho,
Ben
User avatar
Buddha443556
Forum Regular
Posts: 873
Joined: Fri Mar 19, 2004 1:51 pm

Post by Buddha443556 »

It means from the time when executed plus 24 hours (60 sec times 60 = one hour, times 24 equals 24 hours).
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:

Post by pelegk2 »

yesi understand all of this i just asked how the date() function combines the
$format with $timestamp
Grim...
DevNet Resident
Posts: 1445
Joined: Tue May 18, 2004 5:32 am
Location: London, UK

Post by Grim... »

It gives you the date for the time you specify.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

The $timestamp is, of course, a UNIX timestamp representing the number of seconds since the UNIX epoch. $format is a string of characters - some of which are special, and applies that string to the timestamp. So, for date(), 'Y' stands for a 4 digit year. So, date('Y',time()) will give you the current year.

[php_man]date()[/php_man]
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
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:

Post by pelegk2 »

ok thnaks all of u
Post Reply