943,925 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 16069
  • PHP RSS
Mar 6th, 2006
0

tomorrow date??? .

Expand Post »
I am trying to assign tomorrow date to a variable in my program call $tomorrow, but i just cant seem to work out how to do it. Have done today's one by doing

$date = date('Y-m-d');

after reseraching I thought it will make sense to do this

$tomorrow = mktime(0, 0, 0, date("m") , date("d")+1, date("Y"));
but this produced a long number (1141689600). making no sense.

I want the output to be as the same format as the date function used above.

Please please please please can someone help me. Thanks in advance
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
nike123 is offline Offline
20 posts
since Jun 2005
Mar 6th, 2006
0

Re: tomorrow date??? .

[PHP]
$tomorrow = date('Y-m-d',mktime(0,0,0,date('m'), date('d')+1, date('Y')));
[/PHP]
Reputation Points: 36
Solved Threads: 6
Posting Whiz
Troy is offline Offline
354 posts
since Jun 2005
Mar 7th, 2006
1

Re: tomorrow date??? .

Troy's code will work just fine, here's another way of doing it:
[php]$tomorrow = date('Y-m-d',mktime()+86400);[/php]
Reputation Points: 13
Solved Threads: 4
Posting Whiz
paradox814 is offline Offline
351 posts
since Oct 2004
Mar 7th, 2006
0

Re: tomorrow date??? .

Quote originally posted by paradox814 ...
Troy's code will work just fine, here's another way of doing it:
[php]$tomorrow = date('Y-m-d',mktime()+86400);[/php]
Hi,

I think is better to use time() instead of mktime() in this case

And a little explanation:

date() function get's two arguments. first one is date format, second one is function time() which get the current time in UNIX format.
We can manipulate time() function with - or + time.
so 86400 is the sum for the seconds in 24hours.
24*60*60 (24 hours * 60 mins * 60 sec).
Well date function will convert UNIX time time stamp to your date format. That's is...

excuse my english it's not my native language and i hope this will help you to understand how the things work out
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ludesign is offline Offline
9 posts
since Feb 2006
Mar 8th, 2006
0

Re: tomorrow date??? .

Thanks alot guys. Those codes works.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
nike123 is offline Offline
20 posts
since Jun 2005
Apr 2nd, 2006
0

Re: tomorrow date??? .

hi,


try this

TOMORROW=`expr \`date +%s\` + 86400`
date -r $TOMORROW
Reputation Points: 10
Solved Threads: 0
Newbie Poster
rahulgs is offline Offline
1 posts
since Apr 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Pagination - not displaying results properly, please help!
Next Thread in PHP Forum Timeline: PHP in a html page?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC