dd/mm/yyyy to mm/dd/yyyy format
-
Hi in one of my string i have assigned date, the format is dd/mm/yyyy Now i want to change the string as mm/dd/yyyy plz give me a guide how to change it
Thanks & Regards, Member 3879881, please don't forget to vote on the post
-
Hi in one of my string i have assigned date, the format is dd/mm/yyyy Now i want to change the string as mm/dd/yyyy plz give me a guide how to change it
Thanks & Regards, Member 3879881, please don't forget to vote on the post
Member 3879881 wrote:
Hi in one of my string i have assigned date, the format is dd/mm/yyyy Now i want to change the string as mm/dd/yyyy
There are many ways to do it . this is an example.
string strdate = String.Format("{0:yyyyMMdd}", DateTime.Now);
Try google, there are lots of example over there .cheers, Abhijit CodeProject MVP My Blog :Abhijit's World of .Net
-
Member 3879881 wrote:
Hi in one of my string i have assigned date, the format is dd/mm/yyyy Now i want to change the string as mm/dd/yyyy
There are many ways to do it . this is an example.
string strdate = String.Format("{0:yyyyMMdd}", DateTime.Now);
Try google, there are lots of example over there .cheers, Abhijit CodeProject MVP My Blog :Abhijit's World of .Net
Hi abhijit Thanks for ur reply, See i have a date format already in a string, in this format(dd/mm/yyyy); so my string have a value like this 21/02/2008 Now i have to change the string as mm/dd/yyyy (i.e: 02/21/2008) if u have any idea plz share with me
Thanks & Regards, Member 3879881, please don't forget to vote on the post
-
Hi abhijit Thanks for ur reply, See i have a date format already in a string, in this format(dd/mm/yyyy); so my string have a value like this 21/02/2008 Now i have to change the string as mm/dd/yyyy (i.e: 02/21/2008) if u have any idea plz share with me
Thanks & Regards, Member 3879881, please don't forget to vote on the post
string date = textBox1.Text; DateTimeFormatInfo dateTimeFormatterProvider = DateTimeFormatInfo.CurrentInfo.Clone() as DateTimeFormatInfo; dateTimeFormatterProvider.ShortDatePattern = "dd/MM/yyyy"; DateTime dateTime = DateTime.Parse(date, dateTimeFormatterProvider); string formatted = dateTime.ToString("MM/dd/yyyy"); response.write(formatted); I hope this resolves ur problem
-
Hi abhijit Thanks for ur reply, See i have a date format already in a string, in this format(dd/mm/yyyy); so my string have a value like this 21/02/2008 Now i have to change the string as mm/dd/yyyy (i.e: 02/21/2008) if u have any idea plz share with me
Thanks & Regards, Member 3879881, please don't forget to vote on the post
Member 3879881 wrote:
See i have a date format already in a string, in this format(dd/mm/yyyy); so my string have a value like this 21/02/2008
I will suggest you to retrieve the required String format here itself . rather than taking it some other format.
Member 3879881 wrote:
Now i have to change the string as mm/dd/yyyy (i.e: 02/21/2008) if u have any idea plz share with me
use
Split
:)cheers, Abhijit CodeProject MVP My Blog :Abhijit's World of .Net
-
Hi abhijit Thanks for ur reply, See i have a date format already in a string, in this format(dd/mm/yyyy); so my string have a value like this 21/02/2008 Now i have to change the string as mm/dd/yyyy (i.e: 02/21/2008) if u have any idea plz share with me
Thanks & Regards, Member 3879881, please don't forget to vote on the post
yourdatevariable.ToString("mm/dd/yyyy");
umerumerumer
-
yourdatevariable.ToString("mm/dd/yyyy");
umerumerumer
mr_muskurahat wrote:
yourdatevariable.ToString("mm/dd/yyyy");
If you are using DateTime: mm is minutes MM is Month yourdatevariable.ToString("MM/dd/yyyy");