DateTime Class Methods List
Here are some common methods of the DateTime class with a brief description of what they do:
now(): Returns a DateTime object representing the current date and time.
date(): Returns a new DateTime object with the same year, month, and day, but with the time set to midnight.
time(): Returns a new DateTime object with the same time, but with the date set to January 1, 1 (the minimum valid date in the .NET Framework).
year(): Returns the year of the DateTime object.
month(): Returns the month of the DateTime object.
day(): Returns the day of the month of the DateTime object.
hour(): Returns the hour of the DateTime object.
minute(): Returns the minute of the DateTime object.
second(): Returns the second of the DateTime object.
dayofweek(): Returns the day of the week of the DateTime object.
adddays(days): Returns a new DateTime object with the specified number of days added.
addhours(hours): Returns a new DateTime object with the specified number of hours added.
addminutes(minutes): Returns a new DateTime object with the specified number of minutes added.
addseconds(seconds): Returns a new DateTime object with the specified number of seconds added.
addmonths(months): Returns a new DateTime object with the specified number of months added.
addyears(years): Returns a new DateTime object with the specified number of years added.
subtract(other): Returns a TimeSpan object representing the difference between the current DateTime object and the specified DateTime object.
tostring(format): Returns a string representation of the DateTime object using the specified format.
parse(str, format): Converts the specified string representation of a date and time to its DateTime equivalent using the specified format.
tryparse(str, dt): Converts the specified string representation of a date and time to its DateTime equivalent using the specified format, and returns a value indicating whether the conversion succeeded.