« MBS Xojo / Real Studi… | Home | Training days for MBS… »

Tip of day: Time conversion from/to GMT


You can use date class to go to totalseconds in GMT to write to a database and later restore it to local timezone:
// now dim d as new date // now in GMT dim e as new date e.GMTOffset = 0 // show MsgBox str(d.TotalSeconds,"0.0")+" "+str(e.TotalSeconds, "0.0") dim GMTTimeStamp as double = e.TotalSeconds // restore dim f as new date // add GMT offset here f.TotalSeconds = GMTTimeStamp + f.GMTOffset*3600 // because here it's removed f.GMTOffset = f.GMTOffset MsgBox d.ShortTime+" ("+str(d.GMTOffset)+") "+str(d.TotalSeconds,"0.0")+EndOfLine+_ e.ShortTime+" ("+str(e.GMTOffset)+") "+str(e.TotalSeconds,"0.0")+EndOfLine+_ f.ShortTime+" ("+str(f.GMTOffset)+") "+str(f.TotalSeconds,"0.0")
05 09 13 - 11:22
No comments

  
Remember personal info?

Emoticons / Textile


Notify:
Hide email:

Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.