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

    Remedy Dates to VB.net

    rudolfo aguirre

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

       

      using

      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   11.2.0.2.0

      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)

                  Else

                      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

                  Try
                      ' 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
            rudolfo aguirre

            thanks so much - it works

            • 3. Remedy Dates to VB.net
              Carl Wilson

              Hi,

              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.

               

              Cheers