|
|
|
|
![]() ![]() |
Feb 17 2006, 06:00 PM
Post
#1
|
|
|
Member [Level 1] ![]() ![]() ![]() ![]() Group: Members Posts: 58 Joined: 31-January 06 Member No.: 17,937 |
I would like to add one day to date.Doesn't any one have a simple code that I can have.
or mabe a link. date("Y-m-d H:i:s") + (1800 * 24);//this doesnt work ;/ but i need to have 24 hours after date for a check. Thanks for taking the time i hope some one can help me out. Dont warry about it if you dont have some thing already made. |
|
|
|
Feb 17 2006, 06:54 PM
Post
#2
|
|
|
A computer once beat me at chess, but it was no match for me at kick boxing. ![]() Group: [MODERATOR] Posts: 3,954 Joined: 24-July 05 From: In Trouble Again... still? Member No.: 9,787 ![]() |
I think the clock function is based on seconds, so 1 day = 24 hrs * 60 min * 60 secs might work better?
(24*60*60)=86,400 seconds in a day. http://www.trap17.com/forums/index.php?s=&...ndpost&p=206915 Also, try this code found at the php.net site: CODE $this_day=date("Y-m-d H:i:s"); $tomorrow=$this_day + 86400; This should work if the results from the date function can be manipulated in an arithmetic manner. That I do not know, but I can't see why not. The function probably returns the number of seconds since the Unix epoch of midnight Jan 1, 1970 (I think). Otherwise, this might be required: CODE $jump=1; $evalday = mktime(strftime ("%d/%m/%Y", strtotime("+$jump days"))); Have a look at the php.net site for more info. Search for the date function at the top of the page. |
|
|
|
Feb 18 2006, 05:00 AM
Post
#3
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 874 Joined: 30-July 04 Member No.: 246 |
Try this:
CODE date("Y-m-d H:i:s", time()+((60*60)*24)); The date() function calculates the current date based on a UNIX timestamp, which is the number of seconds passed in the UNIX epoch (from 00:00:00 01/01/1970). So to add 24 hours, you simply need to add the number of seconds that exist in 24 hours to the current timestamp - which is (60^2)*24 or 86400 seconds - and pass that to the date() function. Hope that makes sense. |
|
|
|
Feb 19 2006, 10:43 PM
Post
#4
|
|
|
Member [Level 1] ![]() ![]() ![]() ![]() Group: Members Posts: 58 Joined: 31-January 06 Member No.: 17,937 |
thanks all.Spectre, I think your code is more simple so i used it and it works thatnks again
|
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 21st August 2008 - 01:37 AM |