在c#中将西班牙语的日期转换为英语 [英] Convert date in Spanish to english in c#

查看:113
本文介绍了在c#中将西班牙语的日期转换为英语的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





在我的应用程序中,我得到了像12-ago-2013的西班牙语日期,我需要将其转换为英文格式。对于这个使用文化信息如es-US.Before使用文化信息我使用datetime解析日期,它会产生错误。

如何将西班牙语日期转换为正常日期,任何人都可以帮助我,它的非常紧急。

Hi,

In my application,i am getting spanish date like 12-ago-2013,I need to convert this in english format.For this am using culture info like es-US.Before using culture info am parse the date using datetime,it generates an error.
How can i convert spanish date to notmal date,Can any one can help me please,Its very urgent for me.

推荐答案

convert-datetime [ ^ ]



转换的时格式时系统用语言是 - 西班牙语 - 在-C [ ^ ]



检查解决方案......并根据需要进行更改..
convert-datetime[^]

convert-time-format-when-system-language-is-spanish-in-c[^]

Check the solutions..and change it according to your need..


string dateFormat =dd-MMM-yyyy;

CultureInfo provider = new CultureInfo(es-ES);

DateTime dt = DateTime.ParseExact(12-ago-2013​​,dateFormat,provider);
string dateFormat = "dd-MMM-yyyy";
CultureInfo provider = new CultureInfo("es-ES");
DateTime dt = DateTime.ParseExact("12-ago-2013", dateFormat, provider);


这篇关于在c#中将西班牙语的日期转换为英语的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆