Hi everyone,
 
I am trying to generate a time information with the time zone offset
information in the UTC format
 
YYYY-MM-DDTHH:MM:SS.mmm+HH:MM
 
with the last HH and MM referring to the offset of the timezone hours and
minutes from the GMT. My table is created using the following queries
 
CREATE TABLE TwoTimes(localTime datetime, GMTTime datetime);
 
Rows are inserted using the following sql statement
insert into twoTimes(localtime,gmttime)
values(strftime('%Y-%m-%dT%H:%M:%f','now','localtime'),strftime('%Y-%m-%dT%H
:%M:%f','now','utc','+5 minutes'));
 
 
I have written a query of this type to get most of the information.
 
select strftime('%Y-%m-%dT%H:%M:%f',localtime) ||
quote((strftime('%s',localtime) - strftime('%s',gmttime))/3600) || ':' ||
quote((abs((strftime('%s',localtime) - strftime('%s',gmttime)))%3600)/60)
from twotimes

I have the problem of getting the "+" sign ('-' comes through the
calculation itself) and having two digit Hours and minutes for the timezone
offset. 
 
Anyone has done a similar method of implementing. 
 
With Regards
 
Karthick V
HCL Technologies Limited, 
Chennai, India

 
"The secret of being miserable is to have leisure to bother about whether
you are happy or not.  The cure for it is occupation."
George Bernard Shaw (1856-1950)
 
DISCLAIMER 
The contents of this e-mail and any attachment(s) are confidential and intended 
for the 

named recipient(s) only. It shall not attach any liability on the originator or 
HCL or its 

affiliates. Any views or opinions presented in this email are solely those of 
the author and 

may not necessarily reflect the opinions of HCL or its affiliates. Any form of 
reproduction, 

dissemination, copying, disclosure, modification, distribution and / or 
publication of this 

message without the prior written consent of the author of this e-mail is 
strictly 

prohibited. If you have received this email in error please delete it and 
notify the sender 

immediately. Before opening any mail and attachments please check them for 
viruses and 

defect.

Reply via email to