[edit] C# DateTime Day Property
The DateTime Day property simply returns an int that represents the day of a given month (1 to 31).
- Note: Remember, the day property returns an int value not a datetime value.
[edit] Syntax
int variable = DateTime.Now.Day;
[edit] Example
using System;
class Program
{
static void Main()
{
int d1 = DateTime.Now.Day;
Console.WriteLine(d1.ToString());
Console.Read();
}
}
Output:
9
When I ran this program it was April 9, 2007. The output represents the 9th of April.
<= DateTime Tutorial
|