tomorrow date??? .

Reply

Join Date: Jun 2005
Posts: 20
Reputation: nike123 is an unknown quantity at this point 
Solved Threads: 0
nike123 nike123 is offline Offline
Newbie Poster

tomorrow date??? .

 
0
  #1
Mar 6th, 2006
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
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 354
Reputation: Troy is an unknown quantity at this point 
Solved Threads: 5
Troy's Avatar
Troy Troy is offline Offline
Posting Whiz

Re: tomorrow date??? .

 
0
  #2
Mar 6th, 2006
[PHP]
$tomorrow = date('Y-m-d',mktime(0,0,0,date('m'), date('d')+1, date('Y')));
[/PHP]
Troy Wolf is the author of SnippetEdit. "Website editing as easy as it gets." IX Web Hosting
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 348
Reputation: paradox814 is an unknown quantity at this point 
Solved Threads: 4
paradox814's Avatar
paradox814 paradox814 is offline Offline
Posting Whiz

Re: tomorrow date??? .

 
1
  #3
Mar 7th, 2006
Troy's code will work just fine, here's another way of doing it:
[php]$tomorrow = date('Y-m-d',mktime()+86400);[/php]
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 9
Reputation: ludesign is an unknown quantity at this point 
Solved Threads: 0
ludesign's Avatar
ludesign ludesign is offline Offline
Newbie Poster

Re: tomorrow date??? .

 
0
  #4
Mar 7th, 2006
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
Винаги Ñ?е цели в луната, така и да пропуÑ?неш, пак ще Ñ?и Ñ?ред звездите!
by ludesign
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 20
Reputation: nike123 is an unknown quantity at this point 
Solved Threads: 0
nike123 nike123 is offline Offline
Newbie Poster

Re: tomorrow date??? .

 
0
  #5
Mar 8th, 2006
Thanks alot guys. Those codes works.
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 1
Reputation: rahulgs is an unknown quantity at this point 
Solved Threads: 0
rahulgs rahulgs is offline Offline
Newbie Poster

Re: tomorrow date??? .

 
0
  #6
Apr 2nd, 2006
hi,


try this

TOMORROW=`expr \`date +%s\` + 86400`
date -r $TOMORROW
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC