For Programmers: Free Programming Magazines  


Home > Archive > VC Language > January 2006 > ASCII Date time to ticks from 1970









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author ASCII Date time to ticks from 1970
Jacky Luk

2006-01-31, 7:10 pm

Hi,
I need to convert say
Tue 19:00:23 5 March 2006 to ticks from 1970
What is the easiest way to achieve this?
Thanks
Jack


Mark Randall

2006-01-31, 7:10 pm

"Jacky Luk" <jl@knight.com> wrote in message
news:uqdv%23WrJGHA.2320@TK2MSFTNGP11.phx.gbl...
> Hi,
> I need to convert say
> Tue 19:00:23 5 March 2006 to ticks from 1970
> What is the easiest way to achieve this?


OleDateTime

--
- Mark Randall
http://www.temporal-solutions.co.uk
http://zetech.swehli.com

"Those people that think they know everything are a great annoyance to those
of us who do"
Isaac Asimov


Tom Serface

2006-01-31, 7:10 pm

Hi Jacky,

You could use CTime and CTimeSpan as well to get the number of seconds since
1970. I guess you could convert to "ticks" if you multiply by 55 (you'd get
a rough number of ticks).

Tom

"Jacky Luk" <jl@knight.com> wrote in message
news:uqdv%23WrJGHA.2320@TK2MSFTNGP11.phx.gbl...
> Hi,
> I need to convert say
> Tue 19:00:23 5 March 2006 to ticks from 1970
> What is the easiest way to achieve this?
> Thanks
> Jack
>



William DePalo [MVP VC++]

2006-01-31, 7:10 pm

"Jacky Luk" <jl@knight.com> wrote in message
news:uqdv%23WrJGHA.2320@TK2MSFTNGP11.phx.gbl...
> I need to convert say
> Tue 19:00:23 5 March 2006 to ticks from 1970
> What is the easiest way to achieve this?


Easiest, who know? In addition to Mark's and Tom's methods you can call
SystemTimeTofileTime() for two times and subtract the results.

N.B: The ticks used here measure 100 ns intervals.

Regards,
Will


Igor Tandetnik

2006-01-31, 7:10 pm

Jacky Luk <jl@knight.com> wrote:
> I need to convert say
> Tue 19:00:23 5 March 2006 to ticks from 1970
> What is the easiest way to achieve this?


This looks like the format used in HTTP and other communication
protocols. See if InternetTimeToSystemTime helps (you can then flatten
it with SystemTimeToFileTime).
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com