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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:10:27+00:00 2026-06-10T12:10:27+00:00

I have a MySQL table which hen created automatically puts a ISO 8601 timestamp

  • 0

I have a MySQL table which hen created automatically puts a ISO 8601 timestamp into one of the fields. It does this because I have set the default value thought phpMyAdmin to TIMESTAMP.

When I update the field I want to add another timestamp to another field. Obviously I cant do that using the default option. Is there an SQL command to add a current timestamp to a field? I have had a quick read through the MySQL website but I couldnt find a way to do it…

I also had a look to see if there was a way of generating an ISO8601 timestamp through PHP but I couldnt figure out a way to convert from a PHP/unix timestamp to ISO8601.

Cheers!

  • 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-10T12:10:29+00:00Added an answer on June 10, 2026 at 12:10 pm

    MySQL can automatically initialise and/or update a single TIMESTAMP type column within every table to the current time on INSERT and UPDATE. As explained in Automatic Initialization and Updating for TIMESTAMP:

    One TIMESTAMP column in a table can have the current timestamp as the default value for initializing the column, as the auto-update value, or both. It is not possible to have the current timestamp be the default value for one column and the auto-update value for another column.

    In your case, because you want separate columns to hold the record’s initialisation and update times, you will need to set one (or both) of those columns explicitly; one can explicitly set a date/time column to the current date/time in SQL using the NOW() function:

    INSERT INTO my_table (created) VALUES (NOW());
    UPDATE my_table SET updated = NOW();
    

    One can even use triggers to achieve the automatic behaviour that is not natively provided by MySQL:

    CREATE TRIGGER set_init_time AFTER INSERT ON my_table FOR EACH ROW
      SET NEW.created = NOW();
    
    CREATE TRIGGER set_updt_time AFTER UPDATE ON my_table FOR EACH ROW
      SET NEW.updated = NOW();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a large mysql database table in which one column contains values ranging
i have a mySQL table which the data in one of its columns is
I have a main MySQL table which holds products. Any multiple fields for each
I have a MySQL table which contains the following two fields (There are others,
I have a MySql table which has about 100k rows. there is one field
I have mysql table called it as R which contains many fields, but I
I have MySQL table products , which has url and url_crc fields. I have
I have a MySQL table which has about 30 columns. One column has empty
I have a MySQL table with two fields called date and time which are
I have mysql table with following fields id (which auto increments) title,name,age,institution,iod the fields

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.