由网友(举世温柔)分享简介:我有一个字符串( 642014 ),它的格式为 Mdyyyy 。我想字符串转换为 04062014 ( DDMMYYYY )。我曾尝试以下code。请帮助。DateTime.TryParseExact(642014,MMDDYYYYCultureInfo.InvariantCulture,DateTimeStyle...
我有一个字符串( 642014
),它的格式为 Mdyyyy
。
我想字符串转换为 04062014
( DDMMYYYY
)。
我曾尝试以下code。请帮助。
DateTime.TryParseExact(642014,MMDDYYYY
CultureInfo.InvariantCulture,
DateTimeStyles.None,去04062014);
解决方案
这不是一个有效的日期格式。
要突出的问题是 1112014
的月1日
或 1月11日的
?
如果您有约定的某种形式,使您可以决定哪些迄今为止,它指的是在这些情况下,你可以做一些pre的 - 加工或手工解析字符串,但你不会找到任何该格式内置的
I have a string (642014
) which is in the format Mdyyyy
.
I want to convert the string to 04062014
(ddMMYYYY
).
I have tried the following code.Please help.
DateTime.TryParseExact("642014", "MMddyyyy",
CultureInfo.InvariantCulture,
DateTimeStyles.None, out "04062014");
解决方案
That's not a valid date format.
To highlight the issue is 1112014
the 1st of Nov
or 11th of Jan
?
If you have some sort of convention that allows you to determine which date it refers to in these instances you could do some sort of pre - processing or parse the string manually but you're not going to find anything 'built in' for that format
相关推荐
最新文章