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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T04:25:59+00:00 2026-05-21T04:25:59+00:00

I display the date or the time on my website a lot and I’m

  • 0

I display the date or the time on my website a lot and I’m thinking about writing a function to parse a PostgreSQL timestamp.

The timestamp is in the format: Y-m-d H:i:s.u. E.g. 2011-04-08 23:00:56.544.

I’m thinking about something like this:

function parse_timestamp($timestamp, $format = 'd-m-Y')
{
    // parse the timestamp

    return $formatted_timestamp;
}

However I am wondering whether this can also be achieved without writing a parser for it myself (with the use of some PHP function).

  • 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-21T04:25:59+00:00Added an answer on May 21, 2026 at 4:25 am
    function parse_timestamp($timestamp, $format = 'd-m-Y')
    {
        return date($format, strtotime($timestamp));
    }
    

    Don’t forget to set timezone before, e.g.

    date_default_timezone_set('UTC');
    

    Or in your case, I guess 'Europe/Amsterdam'.

    You can always get PHP timestamp of this format Y-m-d H:i:s.u using strtotime(). Then, using date() you can export time in your own format. Both functions depend of time zone set.

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

Sidebar

Related Questions

I want to display date and time in the top of the magento website
I've try searching in this website ways to display date and time. But all
I want to display a date/time submitted value much the same way as Stack
I am using DateField to display the Date and Time in my Blackberry Program,if
I want to display the username/last connection date/time and some other info on all
I'm using the code provided below to display time and date. can anyone help
I want to display the time and date of updated row from MySQL to
Trying to display current time with PHP (using this ): $date = date('m/d/Y h:i:s
I want to display the date time (which I've placed on master page); in
im trying to display date and time from MSSQL Server datetime table using PHP,

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.