Hello Everyone
I am working on a file copy app. I have everything working correctly, but I have a small snag. I cannot have the end user always providing the current date. The files that I want to copy are created daily. I want to write the code that will use the current date, and use the time variables that I supply to compare with the file creation time.
So my question is: How can I compare the file time only with a variable?
Thank you in advance
Andrew SQLDBA
Loading
Manikavelu VelayuthamPosted Aug 25, 2010, 1:57 AM
DateTime systemDate = DateTime.Now;
DateTime compareDate = DateTime.Today.AddHours(11D);
// less than
if (compareDate < systemDate)
Console.WriteLine("Less Than");
// equal to
if (compareDate == systemDate)
Console.WriteLine("Equal To");
// greater than
if (compareDate > systemDate)
Console.WriteLine("Greater Than");
Manikavelu VelayuthamPosted Aug 25, 2010, 1:55 AM
DateTime t1 = DateTime.Now;
DateTime t2 = Convert.ToDateTime("11:00:00 AM");
int i = DateTime.Compare(t1,t2);