Avatar of easttncs
easttncs

asked on 

Problems adding days to a date.

I have a form passing a date in the format of 2007-01-12. I need to add 56 days to that to come up with a begining and ending date to use in a query. Almost everything that I have tried has give me very wierd results.

For example the following date being passed 2007-01-21, to the following code,

      $start_date = $_POST['snapshot_date'];
      $end_date = $start_date + (86400 * 7);
      echo "$end_date";

yields a result of 606807

I have tried using the strtotime() function and it yields similar incorrect results

where am i off point


PHP

Avatar of undefined
Last Comment
TeRReF
ASKER CERTIFIED SOLUTION
Avatar of TeRReF
TeRReF
Flag of Netherlands image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
PHP
PHP

PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.

125K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo