If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > Inserting GMT date

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-16-04, 02:24
lloydnwo lloydnwo is offline
Registered User
 
Join Date: Aug 2003
Location: India
Posts: 262
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
Reply With Quote
  #2 (permalink)  
Old 03-16-04, 08:04
gurey gurey is offline
Registered User
 
Join Date: Aug 2003
Location: Argentina
Posts: 780
Re: Inserting GMT date

Quote:
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.
Reply With Quote
  #3 (permalink)  
Old 03-26-04, 14:27
astrue astrue is offline
Registered User
 
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
Reply With Quote
  #4 (permalink)  
Old 03-30-04, 22:09
lloydnwo lloydnwo is offline
Registered User
 
Join Date: Aug 2003
Location: India
Posts: 262
Re: Inserting GMT date

Quote:
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On