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 6717287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:50:03+00:00 2026-05-26T08:50:03+00:00

A simple code to print a date $first_date = 1319493600; $last_date = 1320184800; $testDate

  • 0

A simple code to print a date

$first_date = 1319493600;
$last_date = 1320184800;

$testDate = $first_date;


while ($testDate<=$last_date)
{
    echo strftime("%a", $testDate).' '. strftime("%d", $testDate).' '.strftime("%b", $testDate).'<br>';
    $testDate += 86400;
}

Yes this simple script fails me as you see below

Tue 25 Oct
Wed 26 Oct
Thu 27 Oct
Fri 28 Oct
Sat 29 Oct
Sun 30 Oct <----Error
Sun 30 Oct <----Error
Mon 31 Oct
Tue 01 Nov

Anyone has any idea why?

  • 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-05-26T08:50:04+00:00Added an answer on May 26, 2026 at 8:50 am

    This is, in fact, the reason why you should never increment the day by adding 24 hours to the timestamp. Chances are that you are in a timezone that observes daylight saving time and the last Sunday of October is not 24 hours long.

    You can confirm this by adding echo strftime("%r %x", $testDate); inside the loop. (Also note that you can use multiple modifiers in strftime() so you don’t have to concatenate them: strftime("%a %d %b", $testDate);.)

    Always use date functions like strtotime() or mktime() to increment the date.

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

Sidebar

Related Questions

This is a simple code that open and print the file content. #include <stdio.h>
This is my code: import datetime today = datetime.date.today() print(today) This prints: 2008-11-22 which
I've written this sample code to print the length of x. But for some
This simple code is not producing any sound on a couple of machines that
I will try to explain this very simple. So, I skipped any code which
I've been glancing at this code for a while now, and I can't seem
Simple code: >>> set([2,2,1,2,2,2,3,3,5,1]) set([1, 2, 3, 5]) Ok, in the resulting sets there
The simple code block below can be served up in a static HTML page
So here is the simple code: [System.ComponentModel.DefaultValue(true)] public bool AnyValue { get; set; }
Hey guys. Check out this piece of sample code. #include stdafx.h #include<conio.h> #include<string.h> class

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.