question

ch.venkatesh514 avatar image
ch.venkatesh514 asked

converting a string to Date

Hi, Can anyone please tell me how to convert this "0x0000000054FFA42E" to Date or date time or time. i have verified it with Isdate() function.it has given "0" as output. is there any other way to convert this value to Date or date time or time. if you want you can add some constant value to it for conversion. Regards, Sql Server User
datetimeconversion
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Kev Riley avatar image Kev Riley ♦♦ commented ·
What value of date/time would that give?
0 Likes 0 ·

1 Answer

·
Kev Riley avatar image
Kev Riley answered
Yes it's possible, but I doubt I've converted it right declare @var varbinary(8) set @var = 0x0000000054FFA42E select dateadd(second,cast(@var as bigint),0) ----------------------- 1945-03-11 02:10:54.000 (1 row(s) affected) The point is I've no idea what that value is supposed to signify. In the example I've given I've assumed it is the binary representation of the number of seconds since 1 Jan 1900. But I doubt it. Can you give us some more information?
4 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ch.venkatesh514 avatar image ch.venkatesh514 commented ·
Its working.. Thank You.
0 Likes 0 ·
ch.venkatesh514 avatar image ch.venkatesh514 commented ·
@kev Riley Is there any way to get that date to today;s date.
0 Likes 0 ·
Kev Riley avatar image Kev Riley ♦♦ commented ·
If you are saying that the value 0x0000000054FFA42E represents today's date (ignoring a time portion for now), then yes they will be some way of converting it back, but we need to know what the function is. Do you know how that value was generated from today's date?
0 Likes 0 ·
ch.venkatesh514 avatar image ch.venkatesh514 commented ·
Hmm..i dnt knw,hw that value generated from Date and which function they used for conversion.
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.