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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:48:41+00:00 2026-06-03T08:48:41+00:00

On my website we store all time & date in the following format: Table

  • 0

On my website we store all time & date in the following format:

Table Column: Date – 16.01.2012
Table Column: Time – 06:36:50pm

This has been causing problems with those who live in different timezones, therefore we are looking at changing this to simple time() strings, however because theres a lot of content on our site that already has such time(old, not time() strings) in the database, we want to keep that data and therefore are wondering how we can go about changing those strings into time().

I understand how to update databases and all, I am lost on actually converting 16.01.201206:36:50pm into its respective time() string, as strtotime likes things to be perfect.

Thank you for your time, and I look forward to your suggestions.

  • 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-03T08:48:43+00:00Added an answer on June 3, 2026 at 8:48 am

    Are you asking how to make the conversion in the database, or how to convert a datetime from the database when it gets loaded into your PHP?

    If it’s the latter, there are lots of ways that you can format your date.

    Taken from the comments of the PHP manual for date_format:

        <?php
    
        $result = mysql_query("SELECT `datetime` FROM `table`");
        $row = mysql_fetch_row($result);
        $date = date_create($row[0]);
    
        echo date_format($date, 'Y-m-d H:i:s');
        #output: 2012-03-24 17:45:12
    
        echo date_format($date, 'd/m/Y H:i:s');
        #output: 24/03/2012 17:45:12
    
        echo date_format($date, 'd/m/y');
        #output: 24/03/12
    
        echo date_format($date, 'g:i A');
        #output: 5:45 PM
    
        echo date_format($date, 'G:ia');
        #output: 05:45pm
    
        echo date_format($date, 'g:ia \o\n l jS F Y');
        #output: 5:45pm on Saturday 24th March 2012
    
        ?>
    

    These are just some examples. Take a look at this page for some more ideas.

    Edit based on comment:

    You can use DateTime::createFromFormat, which allows you to specify the format of the datetime that you are passing in.

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

Sidebar

Related Questions

I have a model called Store with a table column named website and it
I want to store website page hierarchy in a table. What I would like
Background: I have a website where people can store transactions. As part of this
I am designing a Members Table to store the users of a website. It
I'm writing a website and I'm having a problem with saving date and time
I have an website there all user information is stored in Session. But if
I want to crawl a website and store the content on my computer for
I'm trying to write a custom validation for my store.website . I want the
Our Magento store uses the Website Payments Pro payment gateway through PayPal. For the
Users of the website need to able to store images in their area ,

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.