DateTime today = DateTime.Now;
This gets the current date and time into the variable
today
- you can then use what parts of it you need:
today.Day
is the day of the month,
today.Month
is the month of the year,
today.Hour
is the hour of the day,
today.Minute
is the minute of the hour.
Probably, you want to convert this to a string for display, so use the ToString method:
string timeIn12HourClock = today.ToString("hh:mm");
string timeIn24HourClock = today.ToString("HH:mm");
There are load of other formats you can use or construct:
Formatting a DateTime for display - format string description[
^]