Jul 6, 2008

Adding One Day To Date - i'd like to add one day to date

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > PHP Programming

free web hosting

Adding One Day To Date - i'd like to add one day to date

adly3000
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.

Reply

jlhaslip
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.

 

 

 


Reply

Spectre
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.

Reply

adly3000
thanks all.Spectre, I think your code is more simple so i used it and it works thatnks again

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Recent Queries:-
  1. date integer phpbb database - 4.52 hr back.
  2. add day to date php - 8.32 hr back.
  3. php date() add hour - 23.02 hr back.
  4. how to add date in php - 29.95 hr back.
  5. add 1 day to date php - 32.23 hr back.
  6. how to add day in php - 34.86 hr back.
  7. access query enter date plus one day - 38.24 hr back.
Similar Topics

Keywords : adding date date

  1. Php Date()? - timezone is offset (4)
  2. Php Ftp Upload Form - Adding User Directory to PHP Upload Form - Help (0)
    Alright I am trying to have a PHP FTP Upload Form that allows the user to create the directory
    folder for where they want to upload there files to. example: Main Directory: vainsoft.com There
    directory: vainsoft.com/modeling or vainsoft.com/photography But I dont want them to be able to
    upload things into the main directory, only sub-directories, is that possible with this coding that
    I have: //uses $_FILES global array //see manual for older PHP version info //This
    function will be used to get the extension from the filename function get_extension($fi...
  3. Adding String To Integer? - (1)
    Create a PHP program with the following requirements  Create a program that does the following: 
    creates a variable called “test” (remember the dollar sign)  stores the number 35 to
    test and prints the result  adds 10.0000 to test and prints the result  subtracts 5.123123 from
    test and prints it out  stores the character string “happy to be here” to test and
    prints  adds 10.0000 to the variable test (try to guess what will happen) whats the solution to
    this problem? any help would be appreciated....
  4. Displaying Date And Time (gmt+8) - (5)
    how to display date and time (gmt+8)? any help would be appreciated....
  5. Php Date() Problem [resolved] - date() seems to loop same ninute. (4)
    My setup is a macbook pro and I have apache+ mysql + php already included I think. the php is
    version 4.4.4 I have been using the date() to store dates into my mysql tables in the past and it
    worked corectly. I dont know what could of happen but now the date() function is returning an
    incorrect time. I made a test script test.php CODE <?php $date_time =
    date('y-m-d H:m:s'); echo($date_time); ?> and loaded
    it up. My laptops system time would be 1.35.33 PM and the date and time returned from php would be
    07-...
  6. Display The Current Date/time - With a simple PHP code (3)
    Use this code to display the current date and time. CODE <?php   $date =
    date('l dS \of F Y h:i:s A');   echo "$date"; ?>
    "l" would display the current day of the week such as Sunday. d displays the day of the month...
    such as 1 and S adds the appropriate suffix(st). /of simply displays the word "of". F displays the
    current month with no abbreviations while Y displays the four digit year(2007). "h" displays the
    current hour with leading zeros if necessary(Ex. 06 for 6 o'clock). "i" displays the m...
  7. Simple Php Calendar And Yahoo! Calendar Connection - linking each date to Yahoo! calendar (7)
    Original simple PHP calendar source here I was looking for a simple PHP generated calendar. But I
    wanted to place detailed information to show on demand. And installing another database with
    separate management would have been too much of access codes and passwords to remember. And what if
    I want someone else to manage the calendar when I am not able? This is my version of using simple
    PHP calendar script to link to Yahoo! calendar. The twist is that figuring out how Yahoo!
    calendar selection worked. And then depending on which date was clicked it will bring ...
  8. Php Codes: Adding Clothing, Ion Laser Guns And Shooting Projectile Cannons - (3)
    Ok here is a set of codes that is on another forum website. It is really neat becuase you can have
    cursors and other objects on your webpage that can shot projectiles. Also you can add some other
    cool graphics. Go to the link below. php coding ...
  9. Login / Authetication System Using Database - adding information (4)
    Is there any way to make such database where I can write like name and passwords.. Then make an
    login box, and when somebody trys to acces the login he needs to write the name and password.. Then
    it is verifyed if is there such name and password and if it is then acces the page.. I think there
    is posible something like that with MySQL (db).. but can anybody say me a script or way to make
    something like that? Alredy thanks.....
  10. Adding Users To Databases Using Phpmyadmin - (2)
    I am running my own apache server with PHP and MySQL, with phpMyAdmin on my own computer, to test
    things locally. I know how to create databases and how to create users, but how can I add a user to
    a database?...
  11. Editing Footer.php - adding a script (2)
    hey can somebody put this script into my footer.php file? because i don't know how. the script
    has to go between the and ok this is the script... CODE <!-- Clicksor.com Advertising
    Code Begin --> <script type='text/javascript'> <!--
    clicksor_layer_border_color = '#B4D0DC'; clicksor_layer_ad_bg = '#ECF8FF';
    clicksor_layer_ad_link_color = '#0000CC'; clicksor_layer_ad_text_color = '#000000';
    clicksor_text_link_bg = ''; clicksor_text_link_color = '#000FFF';
    clicksor_enable_pop = fa...
  12. Phpbb V2.0.16 Has Been Released - Release Date 06/27/05 (4)
    QUOTE phpBB Group announces the release of phpBB 2.0.16. This release addresses some bugfixes
    and one critical security issue. http://www.phpbb.com/phpBB/viewtopic.php?f=14&t=302011 ...
  13. Sum - Adding things (11)
    I have this tiny problem, that is I have a whole list of vairables, 25 infact, and I'm trying to
    add them, and store this result in another variable. The problem when I try to call that variable
    the resulting page justs leaves a blank spot, and the IF array that I have won't change, it just
    goes for the first choice. Is this wrong? CODE
    $var1+$var2+..........$var24+$var25 = $vartotal; bearing in mind that
    there is more in the middle I just didn't feel like typing it!...
  14. Question About The Date() Function In Php - (4)
    Hi this is the code I've been using. This works perfectly fine with mysql but I'm having
    trouble with getting the exact time. It probably has something to do with time zones and countries.
    Is there something that I need to set to get the time right? I'm from the Philippines and we
    have the same time as Singapore and HongKong. Help please. Tnx. /huh.gif' border='0'
    style='vertical-align:middle' alt='huh.gif' /> CODE $date = date('H:i A, jS
    F Y'); ...
  15. Help With Adding Music/video - help (4)
    Hey, i really need help. How do i add video/ Music to php. If you know please post here nad help
    me. I would really appritiate it. ok thanks....



Looking for adding, day, date, id, add, day, date

Searching Video's for adding, day, date, id, add, day, date
advertisement



Adding One Day To Date - i'd like to add one day to date



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE