This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

How can I convert the current timestamp to a decimal number of 10 digits in C#.

Example Date.Time.Now to some ten digit number representing the time

Example Date.Time.Now to some ten digit number representing the time

Experts Exchange Solution brought to you by

Enjoy your complimentary solution view.

Get every solution instantly with Premium.
Start your 7-day free trial.

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.

But here is an example of a decimal, whcih I am told represents a time.

4557350997

I would like to know what time it actually represents.

I need to convert current timestmap to some number

Jim

the following is the select

SELECT MIN(XTimeStamp) FROM TableData (nolock) WHERE LastModifyTime BETWEEN '01/28/2008' AND '01/28/200812:00:00.000'

and this is what it returns in hexadecimal format

000000010FA3A855

Which I then convert to decimal to give me

4557350997

So what I want to do is enter a decimal timestamp and do the reverse, meaning pass it aa a Binary(8) to a stored proc for processing

Jim

select convert(varbinary(8),conve

result: 0x0A00000155A8A30F

The second cast was necessary because SQL apparently does not convert the constant to a bigint implicitly, so the result was different

Jim

All the information that I ahve is that the field is stored as binary(8) , when I query it I get something like this 0x000000010FA3A855.

So is it possible to do something like this and arrive to a decimal

DateTime.Now.Year * (some num) + DAteTime.Now.Month * (some num) + DateTime.Now.Day * (some number) + DateTime.Now.Hour * (some num) + DateTime.Now.Min * (some num) + DateTime.Now.Sec * (some num)

If you can get some timestamp-number pairs, from the other application like:

0x000000010FA3A855 - 23 Jum 2007 16:45:32

0x000000010ED3A855 - 16 Apr 2007 16:45:32

Then we can probably deduce the algorithm used, and read and write numbers that match those written by the other application. Without the algorithm used by the other system, and without some sample pairs to analyze, there's simply no way to do what you need.

Jim

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 trialI have no idea how those values are stored, I will ask the team soon.

If I do not have an answer by Tuesday, i will award you the points for all the above explantion you provided.

Thanks again for all your help

.NET Programming

From novice to tech pro — start learning today.

Experts Exchange Solution brought to you by

Enjoy your complimentary solution view.

Get every solution instantly with Premium.
Start your 7-day free trial.

Jim