Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 04-20-2009, 12:37 PM Increase Date Value
Average Talker

Posts: 16
Trades: 0
Hi all.

I currently have a database that stores various details relating to each day in a business. I want to be able to take the last date something was entered and display a form for the user to enter the details for the next seven days.

I have selected the most recent value from the database, which is of type date("Y-m-d"), but now I cannot work out how to increase it.

I have tried to add 1 but that increases it by 1 year, I have tried to increase it by seconds but as it's not a timestamp that doesn't work. I have searched around for a while and had no luck.

So I have considered splitting up the date, increasing the day value and putting it back together, but before I try that does anyone have any suggestions?

Thanks very much,
Dan
superdan_35 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-20-2009, 12:44 PM Re: Increase Date Value
Novice Talker

Posts: 12
Trades: 0
Code:
$Now=strtotime("2009-02-02"); //Get Unix Time Date 
$Then=strtotime("+1 day",$Now);  //Add a day
date("Y-m-j",$Then); //Output Formatted Date
For More Information See My PHP Date Math Blog
__________________
Reliable and Legal
Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
?
Find A Paralegal Fast.

Please login or register to view this content. Registration is FREE

Last edited by sjenkins; 04-20-2009 at 12:50 PM..
sjenkins is offline
Reply With Quote
View Public Profile
 
Old 04-20-2009, 05:15 PM Re: Increase Date Value
rogem002's Avatar
PHP Chap

Posts: 843
Name: Mike
Location: United Kingdom
Trades: 0
Take a look at the PHP Manual - http://uk2.php.net/manual/en/function.mktime.php

It seems to have exactly what you need.
__________________
My Blog/Site:
Please login or register to view this content. Registration is FREE
rogem002 is offline
Reply With Quote
View Public Profile Visit rogem002's homepage!
 
Old 04-21-2009, 11:24 AM Re: Increase Date Value
Novice Talker

Posts: 12
Trades: 0
Quote:
Originally Posted by rogem002 View Post
Take a look at the PHP Manual - http://uk2.php.net/manual/en/function.mktime.php

It seems to have exactly what you need.
mktime is great if your constructing a date from scratch

If your working with an existing date strtotime works better.
__________________
Reliable and Legal
Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
?
Find A Paralegal Fast.

Please login or register to view this content. Registration is FREE
sjenkins is offline
Reply With Quote
View Public Profile
 
Old 04-22-2009, 09:49 AM Re: Increase Date Value
Average Talker

Posts: 16
Trades: 0
Thanks for you help. It now works perfectly!

Dan
superdan_35 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Increase Date Value
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.14856 seconds with 12 queries