Pages

Wednesday, 1 June 2011

Outbound : Convert seconds to UTC Time and vice versa

To convert date from export file to seconds passed after 01/01/1970 in Genesys format)

       Dim sDate As String = "01/06/2011 16:46:44"
       Dim date1 As Date = #1/1/1970#

       Dim date2 As Date = DateTime.Parse(sDate).ToUniversalTime

       inSeconds = DateDiff("s", date1, date2))

To convert seconds from database to date and time

        Dim localTime As Date

        Dim date1 As Date = #1/1/1970#

        localTime = date1.AddSeconds(1306943204).ToLocalTime

        Debug.Print localtime.ToString

No comments:

Post a Comment