Convert TimeStamp To String

By | 2002-06-01

Converts the timestamp data type of SQL server into a string that is then suitable for use in a where clause

Original Author: Thomas Robbins

Code

Public Function CvtTimeStamp(TimeSt As String) As String
' This function will recieve the eight byte string of binary data
' returned as the value of a timestamp column and convert it into
' as string in the format 0x000000000000000 suitable for the use in an sql statement
' where clause
Dim HexValue As String
Dim K As Integer
For K = 1 To 8
    HexValue = HexValue & Right$("00" & Hex(AscB(MidB(TimeSt, K, 1))), 2)
Next K
CvtTimeStamp = "0x" & HexValue
  
End Function

Author: dwirch

Derek Wirch is a seasoned IT professional with an impressive career dating back to 1986. He brings a wealth of knowledge and hands-on experience that is invaluable to those embarking on their journey in the tech industry.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.