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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:35:51+00:00 2026-05-27T13:35:51+00:00

I have a script which is fed dates in numerous different formats. I want

  • 0

I have a script which is fed dates in numerous different formats.

I want to save these dates as timestamps so they can easily be manipulated/ordered.

When i try an convert a mm-dd-yyyy type date to a timestamp, it fails.

When the script runs, it does not know what format it will be fed, and as such this cannot be specified. Near all other formats of date seem to be converted fine.

Could anyone advise how to fix this, or alternatively an alternative way that all date formats can be converted to an orderable, consistent format that can be manipulated?

Many Thanks

  • 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-27T13:35:51+00:00Added an answer on May 27, 2026 at 1:35 pm

    It sees strings with - in them as dd-mm-yyyy and / as mm/dd/yyyy.

    See also this question and the comments on the documentation.

    Possible solutions / workarounds:

    • on php 5.3, use date_create_from_format
    • on older php and not on windows, use strptime
    • if neither can be used, either replace the - to / when necessary, or use one of the regexes suggested you can find through the linked question.

    Note however that at some time you do need to know what the format is to start with. Computers are not mindreaders. They can’t, and never will be able to, distinguish between mm-dd-yyyy and dd-mm-yyyy in the overlap ranges (both mm and dd <= 12) if you don’t provide the distinction.

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

Sidebar

Related Questions

I have a script which allows to display Bing search results: JsFiddle I want
I have a script which can make each table row clickable (as a link),
I have a script which can overwrite values in a configuration file using options,
I have a script which I want to run on windows under Cygwin and
I have a script which contacts a few sources and tell them the IP-address
I have a script which logs on to a remote server and tries to
I have a script which will be run interactively by non-technical users. The script
I have this script which basically toggles a bgColor class on and off so
I have a script which hides (display:none) certain divs in the list on page
I have a script which creates a user-defined object like this: obj = new

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.