Hi jhshukla,
Thanks for your answer.
Can you please give me a more detailed explanation?
Do I need the structures to make the conversion?
Is the FileTime the time in seconds ?
is there any example available?
Thanks.
Main Topics
Browse All TopicsHi,
I read time in seconds since 1970 from a text file to a variable of type Double.
(e.g. 1204067242)
How do I convert it to complete date: (e.g. 26.2.2008) and to hour, min,seconds ?
Can I use the time_t type?
If yes, how can I make that the time_t type will accept values of double?
The solution can be in C or in C++
Thanks
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
>> I read time in seconds since 1970 from a text file to a variable of type Double.
(e.g. 1204067242)
I assume this time is expressed in GMT (like commonly used) ?
You don't need to read it as a double. Why not read it as an unsigned integer value (unsigned int, unsigned long, ... whichever is large enough) ? Or cast it to an unsigned integer value.
>> How do I convert it to complete date: (e.g. 26.2.2008) and to hour, min,seconds ?
I assume you want to convert the integer value to a readable string representing the time ?
>> Can I use the time_t type?
Sure. Pretty much all platforms implement time_t as an integral value representing the number of seconds since 01/01/1970 00:00:00 GMT, so :
Reference page for strftime :
http://www.cplusplus.com/r
hi star90,
I know you already accepted the answer from infinity but still I will complete my explanation. his is the better answer (platform independence).
anyway here it goes:
FILETIME structure "contains a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC)." The doc page recommends using ULARGE_INTEGER & 64-bit arithmetic instead of directly manipulating lowPart and highPart of the FILETIME struct.
example:
oops! my mistake. it's LowPart and HighPart.
VS 2008 specific:
if you get that kind of errors, right-click on "ULARGE_INTEGER" and then "Go to Definition." it will lead you to the code where the structure is defined and you can look around to see what else is offered. if you run into typedefs and #defines keep repeating until you find what you are looking for.
Also when you type '.' after the variable name, e.g. 'raw.', a list will pop-up showing the structure's members.
Another option (only for Windows® development) is to go to msdn.com and search for "ULARGE_INTEGER." replace "ULARGE_INTEGER" with whatever type you want to learn about.
syntax of fopen can be found here: http://www.cplusplus.com/r
FILE * file_ptr = fopen("your_file_name", "r");
fscanf(file_ptr, "%I64", &raw.QuadPart);
Business Accounts
Answer for Membership
by: jhshuklaPosted on 2008-08-12 at 20:00:04ID: 22218748
conversion: en-us/libr ary/ms7242 80(VS.85). aspx
en-us/libr ary/ms7242 84(VS.85). aspx en-us/libr ary/ms7249 50(VS.85). aspx
http://msdn.microsoft.com/
structures:
http://msdn.microsoft.com/
http://msdn.microsoft.com/