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

  • Home
  • SEARCH
  • 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 858593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T08:33:46+00:00 2026-05-15T08:33:46+00:00

I have a database row whose type is timestamp. It automatically populates each time

  • 0

I have a database row whose type is “timestamp”. It automatically populates each time a new record has been added with the time of that record’s insertion. Right now for one of the records it holds the value:

2010-06-19 18:40:51

I tried to turn this in to a more user friendly format by:

$timeStamp = $row['date'];
$timeStamp = date( "m/d/Y", $timeStamp);

But it returns this:

12/31/1969

I read somewhere that the date function can only be used on unix timestamps, perhaps what I have in my database isn’t a proper timestamp and I need to convert it to one first before using the date function on it (?). What is the solution?

  • 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-15T08:33:46+00:00Added an answer on May 15, 2026 at 8:33 am

    Use strtotime function:

    $timeStamp = $row['date'];
    $timeStamp = date( "m/d/Y", strtotime($timeStamp));
    

    For the date from your example 2010-06-19 18:40:51, it would return:

    06/19/2010
    

    The timestamp field updates automatically but you can disable that behavior by changing it to DEFAULT CURRENT_TIMESTAMP otherwise it will auto update. From the manual:

    In a CREATE TABLE statement, the first TIMESTAMP column can be declared in any of the following ways:

    With both DEFAULT CURRENT_TIMESTAMP and ON UPDATE CURRENT_TIMESTAMP clauses, the column has the current timestamp for its default value, and is automatically updated.

    With neither DEFAULT nor ON UPDATE clauses, it is the same as DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP.

    With a DEFAULT CURRENT_TIMESTAMP clause and no ON UPDATE clause, the column has the current timestamp for its default value but is not automatically updated.

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

Sidebar

Related Questions

I have a dynamic rows coming from the database. each row has an order
I have a MYSQL database with 50.000 rows. Each row represents an article. I
I have a database column whose type is NUMBER in oracle. I want to
I have a web application that inserts/updates/deletes records from a database. Each time a
i have a UITableView where i want one cell(database row) needs to be default,
I have an Oracle 10g database of genomic data with several >100 million row
I have connected to a table of the database and found a row by
I have a method that deletes a row form a database using the sql
I have a page where I pull a specific row from the database where
Hi I am trying to retrieve values from database. I have a row which

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.