C# 3.0 转换时间格式12 de Marzo 2014 05:51 pm
我需要转换日期到下面的西班牙语格式在c# 2014年12月12日下午5:51C# 3.0 转换时间格式12 de Marzo 2014 05:51 pm,c#-3.0,C# 3.0,我需要转换日期到下面的西班牙语格式在c# 2014年12月12日下午5:51 请建议从这里开始,看看文档丰富而有用的功能: 然后尝试: http://www.php.net/manual/en/function.strftime.php 在您所需的语言设置中,使用逻辑/if语句进行sub操作这是否适合您 DateTime date = DateTime.Parse("12 de Marzo 2014 05:51 pm"); Thread.CurrentThread.CurrentCultur
请建议从这里开始,看看文档丰富而有用的功能: 然后尝试:
http://www.php.net/manual/en/function.strftime.php
在您所需的语言设置中,使用逻辑/if语句进行sub操作这是否适合您
DateTime date = DateTime.Parse("12 de Marzo 2014 05:51 pm");
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
Interaction.MsgBox(date.ToLongDateString());
或
从
string.Format(…)
获得的输出有什么问题?
DateTimeFormatInfo espDtfi = new CultureInfo("es-ES", false).DateTimeFormat;
DateTimeFormatInfo usDtfi = new CultureInfo("en-US", false).DateTimeFormat;
string result = Convert.ToDateTime("12 de Marzo 2014 05:51 pm", espDtfi).ToString(usDtfi.ShortDatePattern);
DateTime.Now.ToLongTimeString() // hh:mm:ss xM
DateTime.Now.ToLongDateString() // dayOfTheWeek, Month dd, yyyy