Convert SysRevId to DateTime

Does anyone know how to convert the SysRevID to DateTime

Data in the Data Base
image

Data in BAQ EPICOR
image

How can i get 2161574192?

0x00000000810B796F is the Hexidecimal equivalent of 2161574192

So it depends where you’re trying to do the conversion. In C# you could use

string SysRevIDHex = "0x00000000810B796F";

int SysRevIDInt = Convert.ToInt32(hexValue, 16);

In SQL (i.e. a Calculated Field in a BAQ), you’d have to do some googling, I’m not as good with that.

Edit: Found this on StackOverflow for SQL

-- If the '0x' marker is present:
SELECT CONVERT(INT, CONVERT(VARBINARY, '0x1FFFFF', 1))

-- If the '0x' marker is NOT present:
SELECT CONVERT(INT, CONVERT(VARBINARY, '1FFFFF', 2))

Also, if you want it in Excel, you can just use =HEX2DEC( SysRevIDHex )

1 Like

Your timestamp next to the SysRevID looks awfully similar to the number you’re trying to get to.
image

Well, sure, if you want to do it the eAsY wAy

Yes, but it should come to the same

Yeah I agree. Maybe that’s the timestamp of the printed report as opposed to the time stamp of the last update to the row in the table.

SysRevID is not a timestamp that can be converted to an actual datetime; it’s a SQL Rowversion

rowversion (Transact-SQL) - SQL Server | Microsoft Learn

It tracks “relative time” (not “actual time”) in the sense that you can key off of it to determine the order in which rows were last updated in a table.

It’s useful for integrations if you’re trying to pick up rows last modified since the last time you ran in integration job:

3 Likes

@TomAlexander Wish I had known this before. But glad I know it know. Thank you.

1 Like

Thank you for helping me. Your comments were very helpful.

1 Like