问题描述
我有一个日期选择器,该日期选择器以dd/MM/yyyy格式显示日期(我知道我自己可以在其中更改,但客户希望那样改变),并在数据库中以MM/dd/yyyy格式显示日期,所以我想转换这样.
例如在23/09/2010文本框中,在C语言中,将其转换为mm/dd/yyyy
如果我将以下代码转换为整数,
I have a datepicker which shows date in format dd/MM/yyyy(i know i coould change there itself but by client want it that way) and in database its in format MM/dd/yyyy so i do want to convert in that way.
e.g. in text box 23/09/2010 and in c sharp its convert to mm/dd/yyyy
if i convert throuth below code,
public static String DMYToMDY(String input)
{
return Regex.Replace(input,
@"\b(?<day>\d{1,2})/(?<month>\d{1,2})/(?<year>\d{2,4})\b",
"${month}/${day}/${year}");
}
转换日期格式时出现错误(指定的字符串不是有效的日期格式).
字符串temp = DMYToMDY("26/10/2012");
DateTime Frm1 = DateTime.Parse(temp);
现在我需要使用datetime格式的10/26/2012.
请帮忙.. !!
i am getting error (String specified is not a valid dateformat) while converting date format.
string temp = DMYToMDY("26/10/2012");
DateTime Frm1 = DateTime.Parse(temp);
now i need 10/26/2012 with datetime format.
please help on this..!
推荐答案
转换日期格式时出现错误(指定的字符串不是有效的日期格式).
字符串temp = DMYToMDY("26/10/2012");
DateTime Frm1 = DateTime.Parse(temp);
现在我需要使用datetime格式的10/26/2012.
请帮忙.. !!
i am getting error (String specified is not a valid dateformat) while converting date format.
string temp = DMYToMDY("26/10/2012");
DateTime Frm1 = DateTime.Parse(temp);
now i need 10/26/2012 with datetime format.
please help on this..!
这篇关于将日期格式从dd/mm/yyyy更改为日期格式MM/dd/yyyy的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!