Sql Server Convert Timestamp to Readable date/time format

is there any built-in function or udf to convert Timestamp to Readable date/time format.

pls help me with this.

tnx in advance!
doc_jerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ram2098Commented:
TimeStamp means ..are you referring to T-SQL 'TimeStamp" datatype? (or) a datetime datatype field?

T-SQL TimeStamp is not a datetime field so you cannot convert it to datetime.

If it is a valid datatime you can use "Convert" function to change it to the required format. See SQL books online for Convert Syntax.
0
doc_jerAuthor Commented:
yah im referring to timestamp datatype. so, how cn i convert that value into readable date format not a datetime datatype.

like this "0x000000000000083D" what is the value in date format?
0
ctcampbellCommented:
A timestamp is not a datetime data type and cannot be converted into a readable date.  In essence, it is simply a counter to know that timestamp A occurred before timestamp B.  Here is a bit from the Books Online:

"timestamp
timestamp is a  data type that exposes automatically generated binary numbers, which are guaranteed to be unique within a database. timestamp is used typically as a mechanism for version-stamping table rows. The storage size is 8 bytes.

Remarks
The Transact-SQL timestamp data type is not the same as the timestamp data type defined in the SQL-92 standard. The SQL-92 timestamp data type is equivalent to the Transact-SQL datetime data type.

A future release of Microsoft® SQL Server™ may modify the behavior of the Transact-SQL timestamp data type to align it with the behavior defined in the standard. At that time, the current timestamp data type will be replaced with a rowversion data type."


If you want a readable date/time value, use datetime, CONVERT, and GETDATE().
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

ram2098Commented:
This is not a date at all.

This is description for BOL for the TimeStamp:

timestamp is a  data type that exposes automatically generated binary numbers, which are guaranteed to be unique within a database. timestamp is used typically as a mechanism for version-stamping table rows.

So, This field is used only to generate a unique value to each row in database. NOT as a date field.
0
ram2098Commented:
Ah..ctcampbell, same time..same posting..surprising !!
0
ctcampbellCommented:
Truly amazing...  exact same time :)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.