Results 1 to 3 of 3
  1. #1

    Question GMT MySQL Timestamp

    I have a column that is a timestamp so as soon as a new row is added it inserts the current date.

    It is formated like: 20040326114906
    And i break it up by doing:
    $joined = $row["joined"];
    $day = substr("$joined", 6, 2);
    $month = substr("$joined", 4, 2);
    $year = substr("$joined", 0, 4);
    $hour = substr("$joined", 8, 2);
    $min = substr("$joined", 10, 2);
    $sec = substr("$joined", 12, 2);
    $joined = "$day $month $year, $hour:$min:$sec";

    But, i was wandering if there was an easier way to do it and also in GMT time.

    Thanks is advance,
    MSN: [email protected]

  2. #2
    Join Date
    Apr 2003
    SELECT DATE_FORMAT(sysdate(), '%d %m %Y, %H:%i:%s') FROM `table_name` LIMIT 1;

    Normal SQL
    SELECT TO_CHAR(sysdate, 'DD MM YYYY, HH24:MIS') FROM dual;

  3. #3
    Thanks, but is there a way to do it without using a mysql query, and also set the timestamp into GMT time or transform it from the server time as it is originaly stamped into GMT?
    MSN: [email protected]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts