GMT Date conversion

Can someone please save my sanity?

I’m trying to convert timestamps to beginning of day.

For example, given that

1513382400 is GMT December 16, 2017 00:00:00 AM (Start of day)
1513468799 is GMT December 16, 2017 11:59:59 PM (End of day)
151345620 which is GMT December 16, 2017 8:30:00 PM (Date to convert)

I would like to know the start and end of the corresponding day.

[code]Public Function GetNextDueDate(dueDate As Int64) as Int64
Dim dDue As xojo.Core.Date
Dim dStart As new Date

dDue = DateSecondsToXojoDate(dueDate)
dStart.SQLDateTime = dDue.Year.ToText + “-” + dDue.Month.ToText + “-” + dDue.Day.ToText + " 00:00:00"

Dim tz As New Xojo.Core.TimeZone(“GMT”) // Get GMT time zone
Dim d As New Xojo.Core.Date(GMTSecondsFromDate(dStart), tz)

Return d.SecondsFrom1970

End Function
[/code]

Guess it just takes putting your frustrations down in a forum to have the light bulb turn on.

[code]Dim dDue As xojo.Core.Date

dDue = DateSecondsToXojoDate(dueDate)

Dim tz As New Xojo.Core.TimeZone(“GMT”) // Get GMT time zone
Dim d As New Xojo.Core.Date(dDue.Year, dDue.Month, dDue.Day, 0, 0, 0, 0, tz)

Return d.SecondsFrom1970
[/code]

Happens to all of us!