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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:01:27+00:00 2026-06-10T19:01:27+00:00

I cant understand this – why does the following occur? echo date(d-m-Y, strtotime($str)); $str

  • 0

I cant understand this – why does the following occur?

echo date("d-m-Y", strtotime($str));

$str = '214454';  // Produces todays date
$str = '333333';  // Produces 1-1-1970
$str = 'a' (or ANY single char)  // Produces tomorrows date
$str = 'aa' (or ANY double char)  // Produces 1-1-1970

OR just returning the strtotime function

echo strtotime($str);

$str = '214454';  // Produces todays date
$str = '333333';  // returns false
$str = 'a' (or ANY single char)  // Produces tomorrows date
$str = 'aa' (or ANY double char)  // returns false

These values came from some testing I was doing, to try and work out how/why certain values were being returned from a specific function.

Its causing my function to fail – because you would assume “a” (or any single char) to be returned as a false incorrect date.

  • 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-10T19:01:28+00:00Added an answer on June 10, 2026 at 7:01 pm

    Both single and double characters are interpreted as timezones (table “used symbols”, row “tz”); six digits are interpreted as HHMMII (table “24 Hour Notation”, row “Hour, minutes and seconds, no colon”).

    Valid formats

    In the 1st and 3rd cases parsing succeeds, strtotime returns a timestamp and date prints whatever date it corresponds to. It’s obvious why the 1st case succeeds; for the 3rd case, remember that military time zones can be referred to with a single letter, and then the results make sense. Let’s follow this code:

    $zones = range('a', 'z');
    $last = null;
    
    foreach($zones as $tz) {
        $ts = strtotime($tz);
        if ($last !== null) {
            echo "TZ $last[0] => TZ $tz: change = ".($ts - $last[1])."\n";
        }
        $last = array($tz, $ts);
    }
    

    This prints

    TZ a => TZ b: change = -3600
    TZ b => TZ c: change = -3600
    TZ c => TZ d: change = -3600
    TZ d => TZ e: change = -3600
    TZ e => TZ f: change = -3600
    TZ f => TZ g: change = -3600
    TZ g => TZ h: change = -3600
    TZ h => TZ i: change = -3600
    TZ i => TZ j: change = -1346649725
    TZ j => TZ k: change = 1346646125
    TZ k => TZ l: change = -3600
    TZ l => TZ m: change = -3600
    TZ m => TZ n: change = 46800
    TZ n => TZ o: change = 3600
    TZ o => TZ p: change = 3600
    TZ p => TZ q: change = 3600
    TZ q => TZ r: change = 3600
    TZ r => TZ s: change = 3600
    TZ s => TZ t: change = 3600
    TZ t => TZ u: change = 3600
    TZ u => TZ v: change = 3600
    TZ v => TZ w: change = 3600
    TZ w => TZ x: change = 3600
    TZ x => TZ y: change = 3600
    TZ y => TZ z: change = -43200
    

    You can see the continuity as we go from one time zone to the next; the discontinuity for timezone 'j' which does not exist (here parsing fails with the same results explained below); the discontinuity at timezone 'n' where we move from UTC+12 to UTC-1, etc.

    Invalid formats

    In the 2nd and 4th cases parsing fails, strtotime returns false and this has the same effect as if you had called date("d-m-Y", 0) — it formats the start of the epoch (January 1st 1970, 00:00:00). This happens because false is converted to the integer 0 as per normal type juggling rules.

    What does strtotime('x') really return?

    It returns the current time at the timezone UTC-11 (this is the “x-ray” military time zone). Depending on your local time and timezone, this is usually either “today” or “tomorrow” from your point of view. If you happen to be at less than UTC-11 then it could even be “yesterday” (although that’s not quite likely).

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

Sidebar

Related Questions

I found the code from the net in which i cant understand this line:-
I cant understand what this warning I get on Xcode is about. Searching for
I'm newbie in Python. I can't understand why this code does not work: reOptions
I Cant understand why this messege come---------> java.lang.NoSuchMethodError: main Exception in thread main .
Maybe I´m just stupid but I cant understand why this isnt working. I want
I cant understand why in the class constructor I can call this function but
some one in tips and tricks say like this plz i cant understand that
I seriously cant understand why this is so hard... I have some experience with
I'm neophyte in obj-c, so I cant understand some of this logic. I want
I've been sitting with this for hours now, and I cant understand why. q

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.