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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:05:09+00:00 2026-06-14T03:05:09+00:00

Maybe I need more sleep but I have some weirdness with strtotime I cannot

  • 0

Maybe I need more sleep but I have some weirdness with strtotime I cannot explain.

The UK localised notation for a date is d/m/Y which is what I am getting within a CSV from an external source to insert into MySQL (format: Y-m-d).

The immediate problem I saw, of course, was that PHP (when using strtotime) converted these wrong. Below is an example of a var_dump of the field value with the post-strtotime var_dump after:

string(10) "13/07/1992" string(19) "1969-12-31 16:00:00" // This one is odd
string(10) "07/09/1992" string(19) "1992-07-09 00:00:00"
string(10) "09/11/1992" string(19) "1992-09-11 00:00:00"

Originally I thought it was because PHP did not support the UK notation ( http://www.php.net/manual/en/datetime.formats.date.php ) and believes it is an American date however that does not explain why if I change my function to replace / with -:

date('Y-m-d H:i:s', strtotime(str_replace('/', '-', $string_time)))

The same dates do work:

string(10) "13/07/1992" string(19) "1992-07-13 00:00:00"
string(10) "07/09/1992" string(19) "1992-09-07 00:00:00"
string(10) "09/11/1992" string(19) "1992-11-09 00:00:00"

I infact have a test set of 200 dates that all work under the - notation.

Shouldn’t the same rules apply here according to the documentation?

  • 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-14T03:05:10+00:00Added an answer on June 14, 2026 at 3:05 am

    The US format uses slashes because that is the convention over there. Normally, dashes aren’t used. strototime()‘s behavior is quite simply:

    • Two digits, slash, two digits, slash, four digits? US format (month, then day).
    • Two digits, dash, two digits, dash, four digits? International format (day, then month).

    A more technical list of formats (and how strototime() interprets them) can be found here.

    You might also be interested in DateTime::createFromFormat.

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

Sidebar

Related Questions

Maybe I need more coffee this morning but here goes... I have a very
Maybe I am just over thinking this and need to write some more prototype
Maybe the question is familiar but I need an explanation in this case. Let's
Maybe this sounds a little bit crazy, but I need to come up with
I need to store various info about some movies, books, games, and maybe other
I haven't actually done this yet, and maybe I don't need to, but it
For some reason I need to display tabular data in my web application but
I'm happy a bit of a variable scoping problem. Maybe I just need more
I maybe need to do a project in Delphi and are a beginner in
I need to store maybe 250 million records of String -> String mappings and

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.