Reputation: 5
in my database i stored date in the format "yyyy-mm-dd" i need to compare the stored dates with the current date. But How can i get the current date in the above format in asp.net.
Upvotes: 0
Views: 307
Reputation: 11
if (DateTime.Today.ToString("yyyy-MM-dd").Equals(myDateString))
{
//Do my thing here
}
Upvotes: 1
Reputation: 3691
You should consider converting that date field in your database schema to a "datetime" data type. That will make it easier to do operations with this value (e.g. equality, greater than, less than, addition, subtraction etc...).
Upvotes: 1