Many Lotus Applications which are Client based need to use the Today's date or current date and store it in dd/mm/yyyy hh:mm:ss:tt AM/PM.
This tip helps you to perform the above action with the prerequisite that Time settings of the user should be in hh:mm:ss:tt format.
First get the server date and time in following format.
Set tempdoc = db.createDocument. lt_ServerTime = tempdoc.Created. timeformat = "hh:mm:ss AM/PM" If session.INTERNATIONAL.DateDMY dateformat = "dd/mm/yyyy hh:mm:ss AM/PM" elseif session.INTERNATIONAL.DateMDY then dateformat = "mm/dd.yyyy hh:mm:ss AM/PM" elseif session.INTERNATIONAL.DateYMD then dateformat = "yyyy/mm/dd/ hh:mm:ss AM/PM" End If lt_ServerTime = Format( lt_ServerTime , dateformat) Dim dttime As New NotesDateTime( lt_ServerTime ) doc.dt_field1 = Cdat( dttime.LsLocaltime).
The value that gets stored in the field is in the Client m/cs date format and its value on Server will be in "dd/mm/yyyy".
To convert Time form one unknown zone to another Zone use following code.
Set dtTime = New NotesDateTime( lt_ServerTime) Set ls_date1 = dttime.GMTtime Set ls_date1 = StrRight( ls_date1 ," GMT"). ls_Hour = Cint(Strleft(ls_date1 ,":" , 5,1)) le_Sec = Cint(Strrightback( ls_date1 ,":" , 5,1)) ls_Minute = Strleft(Strright(ls_date1,":",5,1),":",5,1) ls_Hour1 = Hour( dtTime.LocalTime) ls_Minute1 = Minute( dtTime.LocalTime) ls_Sec1 = Second( dtTime.LocalTime) In_AdtHour = ls_Hour1 - ls_Hour + x( known difference between 1 zoneand GMT) In_AdtMinute = ls_Minute1 - ls_Minute + y In_AdtSec = ls_Sec1 - ls_Sec + z Call dtTime.djusthour( In_AdtHour ) Call dtTime.AdjustMinute( In_AdtMinute ) Call dtTime.AdjustSecond( In_AdtSec ) doc.field1 = dtTime.TimeOnly.