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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:31:49+00:00 2026-05-31T03:31:49+00:00

I have a javascript datetimepicker that I downloaded online which I use to select

  • 0

I have a javascript datetimepicker that I downloaded online which I use to select a start time and end time of a booking.

However, when I select a date and time it is displayed in this format in the input box – 03/12/2012 04:00 pm, as a string I believe.

What I’ve done so far is use the strtotime function which is successfully converting the times into unix timestamps so they can be compared.

However, for storing the start and end times in my mysql database and displaying them to the user I need the date and time to be displayed in a more user friendly and readable datetime format such as 03/12/2012 04:00 or 03/12/2012 04:00:00.

Does anybody know if this is possible and if so how to do it?

Thank you!

  • 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-31T03:31:50+00:00Added an answer on May 31, 2026 at 3:31 am

    You can use this workflow.

    1. Convert 03/12/2012 04:00 to timestamp by strtotime()
    2. Convert timestamp to MySQL format by date("Y-m-d H:i:s", $timestamp); or using DateTime

      $dt = new DateTime();
      $dt->setTimeStamp($timestamp);
      $mysql_date = $dt->format("Y-m-d H:i:s");
      
    3. When you retrieve the date from mysql parse it again with strtotime()

    4. Echo it back to HTML/JS as DateTime::format("d/m/Y h:i:s a");

      $dt = new DateTime($mysql_date);
      $user_friendly_date = $dt->format("d/m/Y h:i:s a");
      

    Links of interest

    • DateTime::__construct()
    • DateTime::format()
    • DateTime::setTimeStamp()
    • date()
    • strtotime()
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have javascript function (that uses Raphael) that on click select area. And I
I have the following function in javascript that calls the ajax which calls the
I have javascript function (that uses Raphael) that on click select area. On double
I have Javascript that opens another window and registers a click handler for all
I have JavaScript that is doing activity periodically. When the user is not looking
I have JavaScript code which copies the value of input file and paste it
I have javascript string variable with var sttr=We prefer questions that can be answered
Is it possible to have JavaScript compute a timestamp returned from PHP's time() function
I've been writing some jQuery functions that have JavaScript variables and looping, etc inside
Duplicate: Do web sites really need to cater for browsers that don’t have Javascript

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.