Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2003
    Location
    India
    Posts
    262

    Unanswered: Inserting GMT date

    Dear all,

    Is it possible to insert GMT date in Informix date/datetime variable or we will have to store it as a char datatypee.
    Below is the output of GMT date --
    Tue Mar 16 12:51:04 GMT 2004

    Regards,

    Lloyd

  2. #2
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    780

    Re: Inserting GMT date

    Originally posted by lloydnwo
    Dear all,

    Is it possible to insert GMT date in Informix date/datetime variable or we will have to store it as a char datatypee.
    Below is the output of GMT date --
    Tue Mar 16 12:51:04 GMT 2004

    Regards,

    Lloyd
    Hi Lloyd,

    No, not is possible.

    Gustavo.

  3. #3
    Join Date
    Dec 2002
    Location
    Portland, OR, USA
    Posts
    26

    Re: Inserting GMT date

    Hi, Lloyd,

    I think the best answer depends on what you need it for, how you want to use it, and what other impacts you are willing to endure for it <g>.

    For instance, one way to do it would be to force the server to run its internal clock on GMT, also known as UTC, with a statement like this in your environment profile (I'm on Red Hat, have it in an /etc/profile.d shell file):

    export TZ="UTC"

    Of course, this forces all of the DateTime vars on the server to be UTC, which could be OK, or it could wreak total havoc, depending on your usage.

    The other solution I thought of, while quite inelegant, is to calculate a current UTC offset for your timezone (have to account for Daylight Savings Time, perhaps) and use that as an INTERVAL HOUR TO HOUR value, and apply that against the DATETIME var prior to persisting it tin the database.

    Hope this helps...

    Regards,
    Joe

  4. #4
    Join Date
    Aug 2003
    Location
    India
    Posts
    262

    Re: Inserting GMT date

    Originally posted by astrue
    Hi, Lloyd,

    I think the best answer depends on what you need it for, how you want to use it, and what other impacts you are willing to endure for it <g>.

    For instance, one way to do it would be to force the server to run its internal clock on GMT, also known as UTC, with a statement like this in your environment profile (I'm on Red Hat, have it in an /etc/profile.d shell file):

    export TZ="UTC"

    Of course, this forces all of the DateTime vars on the server to be UTC, which could be OK, or it could wreak total havoc, depending on your usage.

    The other solution I thought of, while quite inelegant, is to calculate a current UTC offset for your timezone (have to account for Daylight Savings Time, perhaps) and use that as an INTERVAL HOUR TO HOUR value, and apply that against the DATETIME var prior to persisting it tin the database.

    Hope this helps...

    Regards,
    Joe
    Hi Joe,

    Thanks for your feedback, i have datetime fileds which stores timestamp. Business needs to store this in GMT format, my frontend is java. As informix datetime variable stores date in a particular format,
    is it possible to store date in GMT format or i will have to use char variable to store the same. My TZ env. variable is set to GMT+5. Have you done this your application.

    Regards,

    Lloyd

Posting Permissions

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