Hey Guys,
Total Nebwie here. I am trying to get C# programs to output a date without the Time attached. I can specify DateTime.Date, But all that really does it make the Time 12:00. It doesn't really give me Just the Date. Any way of doing this? your help would be greatly appreciated.
Loading
Scott LyslePosted Mar 8, 2007, 4:18 AM
DateTime
dt = DateTime.Now.AddDays(20);MessageBox.Show(dt.ToLongDateString(), "Long Date");
MessageBox.Show(dt.ToLongTimeString(), "Long Time");
MessageBox.Show(dt.ToShortDateString(), "Short Date");
MessageBox.Show(dt.ToShortTimeString(), "Short Time");
MessageBox.Show(dt.ToString("MMMM d, yyyy"), "Custom Format 1");
MessageBox.Show(dt.ToString("d MMM yy"), "Custom Format 2");
MessageBox.Show(dt.ToString("d MMM yy").ToUpper(), "Custom Format 3");
Mike GoldPosted Mar 7, 2007, 6:17 PM
DateTime myDateTime;
...
string output = myDateTime.ToString("dd/MM/yyyy") for the date
for the time
string timeOutput = myDateTime.ToString("hh:mm")