Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7730047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:07:28+00:00 2026-06-01T06:07:28+00:00

$time1 = strtotime(date(Y-m-d, time())); $time2 = strtotime(date(Y-m-d, time())); $time1 = $time1 + (7 *

  • 0
$time1 = strtotime(date("Y-m-d", time()));
$time2 = strtotime(date("Y-m-d", time()));
$time1 = $time1 + (7 * 24 * 60 * 60);
$time2 = strtotime(date("Y-m-d", $time2) . " +1 week");

The second line and third line obviously doing different things in my code. That is when i am processing a date which is older than a month. Is it supposed to be like that ? And why is it doing that ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T06:07:30+00:00Added an answer on June 1, 2026 at 6:07 am

    The difference is that

    $time1 = $time1 + (7 * 24 * 60 * 60);
    

    adds 7 × 24 hours, whereas

    $time2 = strtotime(date("Y-m-d", $time2) . " +1 week");
    

    adds one week.

    Normally, of course, those are the same thing, but your profile says that you live in New Zealand, and Wikipedia says that New Zealand switches from daylight-saving-time to regular time on the first Sunday in April, which was yesterday (or, er, two days ago for you). So it may recently have been the case for you that one week was actually 7 × 24 + 1 hours (because the hour from 2:00 to 3:00 AM on April 1st happened twice), instead of 7 × 24 hours.

    Similarly, in the spring you’ll find that one week can be 7 × 24 − 1 hours.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code $time = strtotime(date('Y-m-d 00:00', strtotime(gmdate('Y-m-d H:i')) + 0)); Its
I have this code to display a date and time from the database. How
I have a function that is accepting the date and time, and number of
I am using strtotime to parse a date that is like 10:24 AM 22-Sep
I want to do something like this strtotime(next starting minute); If the current time
Time and time again I've read on Stackoverflow that I should be using PDO
I have a week calendar that holds events, and want that users can't add
here is the problem...I have just this line of code: <p><div class=author><?php echo $relevantEntry['author'].
any suggestions to make it better? function convertToFBTimestamp($date){ $this_date = date('Y-m-d-H-i-s', strtotime($date)); $cur_date =
I have this function to work out the relative time that has elapsed since

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.