Xojo.Core.Date.Constructor(secondsFrom1970 As Double, timezone As TimeZone)

From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

Constructor

Xojo.Core.Date.Constructor(secondsFrom1970 As Double, timezone As Xojo.Core.TimeZone)

Creates a date using number of seconds from the first instant of 1 January 1970, GMT. Use a negative value to specify a date before this date.

Sample Code

Convert a Unix Epoch value to a date:

Var d As New Xojo.Core.Date(1490621730, Xojo.Core.TimeZone.Current)

Convert a date in the current time zone to GMT:

Var myDate As Xojo.Core.Date = Xojo.Core.Date.Now // Get date for current time zone
Var gmt As New Xojo.Core.TimeZone(0) // Get GMT time zone
Var gmtDate As New Xojo.Core.Date(myDate.SecondsFrom1970, gmt)