UTC Timestamp into MySQL

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • James

    UTC Timestamp into MySQL

    I am attempting to write a statement for inserting a current timestamp into
    a MySQL database. The MySQL field is of type datetime. The statement I
    first tried to generate a value for the field is:

    date("Y-m-d H:i:s")

    Then, I tried:

    gmdate("Y-m-d H:i:s")

    Both resulted in a timestamp in the local timezone. What I wish to do is
    place the timestamp into UTC, so when later displayed in a browser it can be
    converted to a local TZ.

    Thanks for your help!
    James


  • william

    #2
    Re: UTC Timestamp into MySQL

    On Wed, 03 Jan 2007 07:50:35 -0600, James wrote:
    Both resulted in a timestamp in the local timezone. What I wish to do is
    place the timestamp into UTC, so when later displayed in a browser it can be
    converted to a local TZ.

    Comment

    • Toby Inkster

      #3
      Re: UTC Timestamp into MySQL

      James wrote:
      I am attempting to write a statement for inserting a current timestamp into
      a MySQL database.
      INSERT INTO my_table (footime, foostring) VALUES (NOW(), 'garble');

      --
      Toby A Inkster BSc (Hons) ARCS
      Contact Me ~ http://tobyinkster.co.uk/contact

      Comment

      Working...