|
-
Dec 10th, 2004, 01:24 AM
#1
Thread Starter
Frenzied Member
formating a date to dd/mm/yyyy format
Hello,
I am using a DateTime variable. But l want to change the format of the shortDateString from mm/dd/yyyy to the new format of dd/mm/yyyy.
I used the code below using, using System.Globalization. However, it won't change to this new format of dd/mm/yyyy
DateTime today = Convert.ToDateTime(DateTime.Today.ToShortDateString());
DateTimeFormatInfo dateFormat = new DateTimeFormatInfo();
dateFormat.ShortDatePattern = "dd/mm/yyyy";
today.ToString(dateFormat);
Can anyone help with this.
Many thanks in advance,
Steve
Last edited by steve_rm; Dec 11th, 2004 at 05:26 AM.
steve
-
Dec 10th, 2004, 09:53 AM
#2
Frenzied Member
Re: query database that contain dates
It might be a date format problem as you are in the UK. Try reformating the date into a yyyy-mm-dd format and see if that helps.
DJ
-
Dec 11th, 2004, 09:05 AM
#3
Sleep mode
Re: formating a date to dd/mm/yyyy format
Try this :
Code:
DateTime today = DateTime.Now.Date;
MessageBox.Show(today.ToString("dd/MM/yyyy"));
-
Dec 12th, 2004, 05:37 AM
#4
Frenzied Member
Re: formating a date to dd/mm/yyyy format
Hey thats not the same question I answered. If you are going to ask a different question add resolved to the existing post title and post a new one otherwise the thread just doesn't make sense!
DJ
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|