convert date formats [modified]
-
hy everyone! is it possible to easyly convert date formats into different formats. what i want to do is to convert a date format from english format to german format or vice versa. i do have a function which looks like
public static string ConverFormat (string input, string format, string Cultureinfo)
so when entering this function input contains the date, format contains the formatstring, in which format to display (e.g. {"mm/dd/yyyy"}) and cultureinfo contains the cultureinfo (e.g. en-US) to which the input has to be converted to (english or german format). so let's say input = 01.05.2008, format = {mm/dd/yyyy} and cultureinfo = en-US then the output should be 05/01/2008. in here how to convert datetime.now into desired format???[^] i found how to format the type of how to display the date. but i want to switch it from dd.mm.yyyy to e.g. mm/dd/yyyy or mm.dd.yyyy (following the the format declared in parameter format). do i have to do this by hand, meaning parsing the string and change it to the desired format or is there a chance to do this using default functions? thanks! Stephan.modified on Thursday, May 1, 2008 6:25 AM
-
hy everyone! is it possible to easyly convert date formats into different formats. what i want to do is to convert a date format from english format to german format or vice versa. i do have a function which looks like
public static string ConverFormat (string input, string format, string Cultureinfo)
so when entering this function input contains the date, format contains the formatstring, in which format to display (e.g. {"mm/dd/yyyy"}) and cultureinfo contains the cultureinfo (e.g. en-US) to which the input has to be converted to (english or german format). so let's say input = 01.05.2008, format = {mm/dd/yyyy} and cultureinfo = en-US then the output should be 05/01/2008. in here how to convert datetime.now into desired format???[^] i found how to format the type of how to display the date. but i want to switch it from dd.mm.yyyy to e.g. mm/dd/yyyy or mm.dd.yyyy (following the the format declared in parameter format). do i have to do this by hand, meaning parsing the string and change it to the desired format or is there a chance to do this using default functions? thanks! Stephan.modified on Thursday, May 1, 2008 6:25 AM
i guess, i just found what i am looking for :) http://msdn.microsoft.com/en-us/library/5hh873ya.aspx[^] thanks anyway! Stephan.
-
hy everyone! is it possible to easyly convert date formats into different formats. what i want to do is to convert a date format from english format to german format or vice versa. i do have a function which looks like
public static string ConverFormat (string input, string format, string Cultureinfo)
so when entering this function input contains the date, format contains the formatstring, in which format to display (e.g. {"mm/dd/yyyy"}) and cultureinfo contains the cultureinfo (e.g. en-US) to which the input has to be converted to (english or german format). so let's say input = 01.05.2008, format = {mm/dd/yyyy} and cultureinfo = en-US then the output should be 05/01/2008. in here how to convert datetime.now into desired format???[^] i found how to format the type of how to display the date. but i want to switch it from dd.mm.yyyy to e.g. mm/dd/yyyy or mm.dd.yyyy (following the the format declared in parameter format). do i have to do this by hand, meaning parsing the string and change it to the desired format or is there a chance to do this using default functions? thanks! Stephan.modified on Thursday, May 1, 2008 6:25 AM
Please only use ISO 8601 formats -- yyyy-MM-dd