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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T22:52:58+00:00 2026-05-21T22:52:58+00:00

strtotime() in PHP works great if you can provide it with a date format

  • 0

strtotime() in PHP works great if you can provide it with a date format it understands and can convert, but for example you give it a UK date it fails to give the correct unix timestamp.

Is there any PHP function, official or unofficial, that can accept a format variable that tells the function in which format the date and time is being passed?

The closest I have come to doing this is a mixture of date_parse_from_format() and mktime()

// Example usage of the function I'm after
//Like the date() function but in reverse
$timestamp = strtotimeformat("03/05/2011 16:33:00", "d/m/Y H:i:s");
  • 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-21T22:52:58+00:00Added an answer on May 21, 2026 at 10:52 pm

    If you have PHP 5.3:

    $date = DateTime::createFromFormat('d/m/Y H:i:s', '03/05/2011 16:33:00');
    echo $date->getTimestamp();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying the following command in PHP 5.2.12 : print (date('Y-m-d', strtotime('2009-12 last day')));
echo date(W,strtotime('2010-01-01')); This outputs 53. I would expect it to output 1. Can anyone
I'm trying to use strtotime to convert the following date: 07/09/2009 17:01:27 It's the
var_dump(strtotime(2012-W07 Monday)); returns int 1329170400 on my local computer (PHP Version 5.3.4) but on
What is the best (date format independent way) in PHP to calculate difference in
I've been using PHP's strtotime() method to accept a date field on a form.
Is there a simple way to convert one date format into another date format
Here is date format function in PHP. function formatMyDateNicely($strTimeString) { return date('F j, y
I'm using strtotime($my_time); to create timestamps that I use in php math. The variable
Possible Duplicate: strtotime failing on mm-dd-yyyy hh:mm I have a date coming in like

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.