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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:33:21+00:00 2026-05-28T00:33:21+00:00

EDIT Per the comment below, here’s my attempt at splitting / combining / converting

  • 0

EDIT

Per the comment below, here’s my attempt at splitting / combining / converting the string prior to implementing mktime…

$date1 = explode("T",'2005-03-27T00:00:00');
$date2 = explode("-", $date1[0]);
$try = mktime($time1,$time2,0,$date2[1],$date[2],$date[3]);
print $try; 

// Prints out: 951793200

Original Question:

I’ve inherited a database and would like very much to convert the bizarre way the data is stored to something more mysql-friendly…

In the meantime, I get a text string (yes… text)… That I’d like to convert to unixtime…

So, I’ll get a string that looks like this:

2005-03-27T00:00:00 03:00 AM

I’d like to convert it to:

1111885200

Dates and times always mess me up… I’ve done a number of things using strtotime and mktime, but can’t get it formatted the way I want.

  • 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-28T00:33:21+00:00Added an answer on May 28, 2026 at 12:33 am

    Well, this is how I would do it.

    $ex = '2005-03-27T00:00:00 03:00 AM';
    $format = '%Y-%m-%dT00:00:00 %H:%M %p';
    $strf = strptime($ex, $format);
    $date_str = $strf['tm_mon'] + 1 . '/' . $strf['tm_mday'] . '/' . ($strf['tm_year'] + 1900) . ' ' . $strf['tm_hour'] . ':' . $strf['tm_min'] . ':00';
    echo $date_str;
    echo "\n";
    echo strtotime($date_str);
    echo "\n";
    echo date('m-d-Y H:i:s', 1111885200);
    

    But, your desired result does not seem to be correct based on the date you posted.

    OUTPUT

    3/27/2005 3:0:00
    1111921200
    03-26-2005 17:00:00
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

EDIT : Per Slaks $j('#banner-content img').each(function() { var link = $j('#page-tabs li a.' +
EDIT: For the inner queries, there could be more than one match per inner
How do you edit a tab label, per tab, in GVim? You can do
Edit: Updating post based on Martins comments below Hello, I'm just trying to get
In the following code why does mockTest.ToString() return Null? EDIT: Added comment into example
Edit: This question was written in 2008, which was like 3 internet ages ago.
Edit: From another question I provided an answer that has links to a lot
EDIT: This was formerly more explicitly titled: - Best solution to stop Kontiki's KHOST.EXE
EDIT: Learned that Webmethods actually uses NLST, not LIST, if that matters Our business
EDIT: This question is more about language engineering than C++ itself. I used C++

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.