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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:11:34+00:00 2026-06-01T23:11:34+00:00

I have converted date to my local time as below: $this->date_string = %Y/%m/%d %h:%i:%s;

  • 0

I have converted date to my local time as below:

$this->date_string = "%Y/%m/%d %h:%i:%s";
  $timestamp = now();
  $timezone = 'UP45';
  $daylight_saving = TRUE;
  $time =  gmt_to_local($timestamp, $timezone, $daylight_saving);
$this->updated_date = mdate($this->date_string,$time); 

And I’m storing this field in to database.

Now at retrieval time I want format like this:
“11-04-2011 4:50:00 PM”

I have used this code:

$timestamp = strtotime($rs->updated_date);
$date1 = "%d-%m-%Y %h:%i:%s %a";
$updat1 = date($date1,$timestamp); 

But this will give me only

"11-04-2011 4:50:00 AM" 

But I have stored it like it was PM.

  • 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-01T23:11:36+00:00Added an answer on June 1, 2026 at 11:11 pm

    Might get voted down, but will have a go at it.
    Is it because the MySQL stores it in 24 hour format? (assuming you are using the datetime field type)

    Maybe this will help
    Converting mysql TIME from 24 HR to AM/PM format
    sorry if it doesn’t.

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

Sidebar

Related Questions

I have a date converted to double value and saved in database. Now, I
I have a string containing a local date/time and I need to convert it
I have a requirement to convert a date from a local time stamp to
I have a date like this:- 20091023 i have to convert it to a
Is it possible in javascript to convert some date in timestamp ? i have
I have converted an array to object data like this: <?php $myobject->data = (object)Array('zero','one','two');
I have a ISO 8601 date, lets say: 2012-01-19T19:00-05:00 My machine timezone is GMT+1
I have written a function to convert a date into a Unix time stamp.
I'm trying to convert a timestamp string to Date in PHP. I have following
I have this code to change system time. This code works but somehow doesn't

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.