www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Algorithm to determine if a file was modified today

reply Lubos Pintes <lubos.pintes gmail.com> writes:
Hi,
Can someone tell me an algorithm which determines if a file specified by 
its name was modified today?
I suspect that I will need a std.datetime module to work with dates, and 
something from somewhere that would tell me the modification date and 
then convert and compare.
But std.datetime is quite large... Sorry if this looks like laziness. :-)
Thank.
Feb 21 2013
parent "John Colvin" <john.loughran.colvin gmail.com> writes:
On Thursday, 21 February 2013 at 12:40:37 UTC, Lubos Pintes wrote:
 Hi,
 Can someone tell me an algorithm which determines if a file 
 specified by its name was modified today?
 I suspect that I will need a std.datetime module to work with 
 dates, and something from somewhere that would tell me the 
 modification date and then convert and compare.
 But std.datetime is quite large... Sorry if this looks like 
 laziness. :-)
 Thank.
http://dlang.org/phobos/std_file.html#timeLastModified and then you should be able to very easily use the methods etc. of http://dlang.org/phobos/std_datetime.html#.SysTime to work out whether it was modified on any particular day.
Feb 21 2013