GMT Issues

In Lotusscript: For the NotesDateTime Object, the help file clearly says:

The LotusScript functions DateNumber and TimeNumber can be used to avoid dependencies on regional settings. For example, the sum of DateNumber and TimeNumber can be written to GMTTime or LocalTime to set a NotesDateTime object.

I reiterate: the sum of DateNumber and TimeNumber can be WRITTEN to GMTTime or LocalTime to set a NotesDateTime object.

The GMTTime property is READ ONLY. Is this a misprint? ( I wish I could write to that property!)

My issue is, imported from an outside source, I have a date value in the format “20080305T193000Z”, clearly a GMT time. I need to make a NotesDateTimeObject where the GMTTime property will return this given time (03/05/2008 07:30 PM)[Zulu] and therefore, the properly adjusted local time.

Any clues?

TIA

Leo

Subject: GMT Issues

The GMTTime property is READ ONLY. Is this a misprint? ’

No, it means if your field StartTime is [2008-02-22 5:00pm EST]

Then StartTime.GMT is [2008-02-22 10:00pm GMT]

It’s just a property of the time.

When they say: “DateNumber and TimeNumber can be written to GMTTime or LocalTime to set a NotesDateTime object.”

They mean when I set a date time I can either set it as [2008-02-22 5:00pm] or [2008-02-22 10:00pm GMT] or [2008-02-22 5:00pm EST]

In the first case I didn’t specify any time zone information - therefore the system will assume I mean local time and change it to Eastern in my case. However, if a coworker in my in California ran the same piece of code it would assume 5:00 PST.

The second case I sepecified the time in GMT, so no matter what time zone I’m in the date/time should be [2008-02-22 10:00pm GMT]. SO I run it, it’s 10:0pm GMT or 5:00pm Eastern. My coworker runs it, it’s still 10:00pm GMT or 2:00pm GMT

You can also speciy other timezones other that GMT as the last case shows.

Also it will accept 24 hour time format so I could be using 1700 and 2200 instead of 5:00pm and 10:00pm

Therefore to take your time: 20080305T193000Z

I don’t think you can do Set StartTime = New NotesDateTime(“20080305T193000Z”) - never tried it, maybe notes has a undocument functionality to handle this, so give it a try.

I would parse it to get year, month, day, hour, minutes and seconds and (Not pretty)

Set StartDate = New NotesDateTime ( Cstr(DateNumber( year, month, day)) + " " + Cstr(TimeNumber(hour, minutes, seconds)) + " GMT")

Subject: RE: GMT Issues

I like the idea of:

Set StartDate = New NotesDateTime ( Cstr(DateNumber( year, month, day)) + " " + Cstr(TimeNumber(hour, minutes, seconds)) + " GMT")

So simple…

Thanks, it worked!