3 Replies Latest reply on Nov 10, 2011 11:55 PM by Carl Wilson

    Remedy Dates to VB.net

      how do I convert a remedy date like 1225713687 to a vb.net date format?



      BMC Remedy User

      Version 7.5.00 Patch 004

      Dec 31, 2009

      Microsoft Visual Studio 2005

      Version 8.0.50727.4039  (QFE.050727-4000)

      Microsoft .NET Framework

      Version 2.0.50727 SP2

      Oracle Developer Tools for Visual Studio

      Oracle Developer Tools for Visual Studio Copyright (c) 2005, 2010



      thanks Rudy

        • 1. Remedy Dates to VB.net
          Carl Wilson

              Public Function EpochToDateTime(ByVal EpochValue As Integer) As Date

                  ' // Convert Epoch Integer to Real Date/Time

                  If EpochValue > 0 Then

                      Return CDate("1.1.1970 00:00:00").AddSeconds(EpochValue)


                      Return CDate("1.1.1970 00:00:00")

                  End If

              End Function



             Public Function DateTimetoEpoch(ByVal DateTime As String, ByRef ErrMsg As String) As Long
                  Dim EpochTime As Long

                      ' Does not account for leap seconds
                      EpochTime = DateDiff("s", #1/1/1970#, DateTime)

                      Return EpochTime
                  Catch ex As Exception
                      ErrMsg = ex.Message
                  End Try
                  Return String.Empty
              End Function

          • 2. Remedy Dates to VB.net

            thanks so much - it works

            • 3. Remedy Dates to VB.net
              Carl Wilson


              can you please mark the answer (and not your own post) as correct or helpful so others can see what the solution was when searching.