Link to home
Start Free TrialLog in
Avatar of tangkh
tangkh

asked on

Change Date

How do I change the dates of a file I opened? I used to be able to do it in DOS environment using Turbo C. But Windows/MFC doesn't seem to offer this feature anymore. What it offers is to use CFileStatus class, which uses 64-bits clock ticks from 1601 March 1. I don't want to do the conversion myself because it is a lot of hassle. Any suggestion?
Avatar of jkr
jkr
Flag of Germany image

Simply use the 'SetFileTime()' Win32 API, it is designed for this task ;-)
Avatar of tangkh
tangkh

ASKER

this is my point, i dont want to use the tick count (interval of 100 ns). i want to, says, change the file's date by simply typing only 1998:11:23 to change it. I am not going to do the conversion from the tick count to the date... :(
You're right - it IS a hassle ;-)

But there are several convenience functions that allow the conversion of common time formats into FILETIME structures, e.g. 'DosDateTimeToFileTime()' which can be used to create FILETIME. So you could e.g. still use the 'strftime()', 'asctime()' etc.

Avatar of tangkh

ASKER

Hohohoho ^o^ you deserved the points. I have been struggling to get this type of function. Thanks :)
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial