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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:03:26+00:00 2026-05-25T11:03:26+00:00

I have a column in my table of type datetime . I want to

  • 0

I have a column in my table of type datetime. I want to display them in a particular format, so I tried using this:

echo date( 'm/d/Y - g:h A', strtotime($dateFromMySQL) );

…which just messes everything up, completely.


If I simply do echo $dateFromMySQL; (in a loop), I get this:

2011-09-10 01:03:04
2011-09-10 00:52:47
2011-09-10 00:40:26
and so on…

…which is correct.


If I do echo strtotime($dateFromMySQL);, I get this:

1315630984
1315630367
1315629626
and so on…

…which might be correct. I wouldn’t know.


However, when I do echo date( 'm/d/Y - g:h:s A', strtotime($dateFromMySQL) );, I get this:

09/10/2011 – 1:01:04 AM
09/10/2011 – 12:12:47 AM
09/10/2011 – 12:12:26 AM
and so on…

…which is obviously wrong.


So, my question is, what am I doing wrong?
Am I somehow not using strtotime and date correctly?

  • 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-25T11:03:26+00:00Added an answer on May 25, 2026 at 11:03 am

    I think you’re looking for m/d/Y - g:i:s A.

    h – hour
    i – minutes

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

Sidebar

Related Questions

I have a table with a column of type dateTime. I want to do
I have a table that has a column with type of dateTime(I'm using SQL
I have a last_notified column on my MySQL table, data type DATETIME I want
I have a table 'customertransactions' with a column 'transactiondate' of type DateTime. I will
I have a MySQL table and a column of type datetime. It's default value
I have a char type column in table. I want to convert it to
I have a records in my table Test like this my Date column is
I have a table and one of the columns is Date of type datetime.
I have a column called test_date , type datetime in General Exam table. I
I have premiere_poland column in database table which is date type. /** @Column(type=date, nullable=TRUE)

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.