Ad Widget

Collapse

Excel reporting from Mysql

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Kso
    Junior Member
    • Aug 2008
    • 9

    #1

    Excel reporting from Mysql

    Hi,

    I need to make report into excel from the data stored in the mysql zabbix database.
    Does anybody know how to convert Clock integer into readeable DateTime?
  • Tenzer
    Senior Member
    • Nov 2007
    • 316

    #2
    Maybe the MySQL manual can help you out.
    http://dev.mysql.com/doc/refman/4.1/...ime-types.html

    Comment

    • Kso
      Junior Member
      • Aug 2008
      • 9

      #3
      Thank you Tenzer,

      I already checked the manual pages but with no success.
      I cannot convert clock as datetime or any type:
      example:
      > desc history;
      +--------+---------------------+------+-----+---------+-------+
      | Field | Type | Null | Key | Default | Extra |
      +--------+---------------------+------+-----+---------+-------+
      | itemid | bigint(20) unsigned | NO | MUL | 0 | |
      | clock | int(11) | NO | | 0 | |
      | value | double(16,4) | NO | | 0.0000 | |
      +--------+---------------------+------+-----+---------+-------+
      select * from history limit 10;
      +--------+------------+--------+
      | itemid | clock | value |
      +--------+------------+--------+
      | 18472 | 1217652264 | 0.0854 |
      | 18472 | 1217652272 | 0.1850 |

      select cast(1217652264 as datetime);
      +------------------------------+
      | cast(1217652264 as datetime) |
      +------------------------------+
      | NULL |
      +------------------------------+


      What does the clock represent ?
      Number of seconds since which date ?

      Comment

      • Tenzer
        Senior Member
        • Nov 2007
        • 316

        #4
        Try out:
        SELECT FROM_UNIXTIME(clock) FROM history LIMIT 3;

        http://dev.mysql.com/doc/refman/5.0/..._from-unixtime

        The date is a normal Unix timestamp which counts the seconds from the 1st of January 1970 00:00 UTC.

        Comment

        • Kso
          Junior Member
          • Aug 2008
          • 9

          #5
          Thank you very much Tenzer !!!

          That's what i was looking for .

          Comment

          Working...