Results 1 to 2 of 2

Thread: Reporting & GMT & MySql

  1. #1
    mikesolomon is offline Sugar Community Member
    Join Date
    Feb 2008
    Location
    UK
    Posts
    1,467

    Default Reporting & GMT & MySql - How to convert GMT to the required Timezone

    I started using ireports & was initially confused by the fact that all times are held in GMT

    I came up with a solution for MySql and thought I'd share it

    The trick is to use the MySql CONVERT_TZ function

    First try SELECT CONVERT_TZ('2004-01-01 12:00:00','GMT','MET');

    If that returns null your timezone tables are not setup - for details on how to set them up see

    http://dev.mysql.com/doc/refman/5.0/...e-support.html

    Once that is done you can then convert dates in your reports to whatever timezone you like

    for example

    SELECT
    name, TIME(CONVERT_TZ(date_start,'GMT','GB'))
    FROM
    tasks

    That converts GMT to BST

    To see the available timezone names look in the database mysql - table : time_zone_name

    I hope you find this useful
    Last edited by mikesolomon; 2008-04-17 at 08:24 AM.

  2. #2
    jsagar's Avatar
    jsagar is offline Sugar Community Member
    Join Date
    Mar 2008
    Location
    Ahmedabad,India
    Posts
    242

    Default Re: Reporting & GMT & MySql

    HI mikesolomon
    thank you very much. this is really helpfull for me. great job
    Best Regards
    ---------------------------------------
    Jaydeepsinh Sagar

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Query Failed: AND users.id = '1'::MySQL error 1064:
    By artco001 in forum Installation and Upgrade Help
    Replies: 63
    Last Post: 2009-05-07, 05:56 AM
  2. Replies: 5
    Last Post: 2007-11-13, 02:51 PM
  3. MySQL Database Not Available
    By luisamato in forum Help
    Replies: 4
    Last Post: 2007-06-27, 05:58 AM
  4. Huge backups -- normal?
    By Liam in forum Help
    Replies: 5
    Last Post: 2007-05-02, 05:36 AM
  5. MySQL error/no workflow notifications
    By rlbyrd in forum Help
    Replies: 1
    Last Post: 2006-09-11, 09:14 PM

Bookmarks

Posting Permissions

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