Date

How do I get today's date and put in an object/variable? ThanksSmile
[128 byte] By [Sandrina] at [2008-2-8]
# 1
Hi!
Use the System.DateTime structure! Here is an example:


using System;
using Console;

namespace Examples
{
public class DatetimeExampleClass
{
[STAThread]
static void Main(string[]args)
{
WriteLine(DateTime.Now.ToLongDateString());
}
}
}


I hope I helped you.
webmonsta at 2007-8-21 > top of Msdn Tech,Visual C#,Visual C# General...
# 2

Just to expand Webmonsta's post above:

To put it it a variable, you would do the following:


using System;

namespace Examples
{
public class DatetimeExampleClass
{
[STAThread]
static void Main(string[]args)
{
DateTime date = DateTime.Now;
}
}
}

DavidM.Kean at 2007-8-21 > top of Msdn Tech,Visual C#,Visual C# General...