.NET里有没有什么函数.可以直接把中文日期格式转换成英文格式

cpbmy 2007-07-18 10:51:55
.NET里有没有什么函数.可以直接把中文日期格式转换成英文格式
如 7月18日 -> July 18
...全文
1509 15 打赏 收藏 转发到动态 举报
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
beyondjay 2007-07-20
  • 打赏
  • 举报
回复
Globalization.CultureInfo("en-GB");
是最好得
超级大笨狼 2007-07-20
  • 打赏
  • 举报
回复
打算写英文简历的进来,给你一个小工具.

The person who plans to write the English resume comes in, give you a small tool..
翻译效果

翻译(小偷)工具:
www.dullwolf.cn/tanslator.exe

下载,需要.Net2.0支持
chao33 2007-07-20
  • 打赏
  • 举报
回复

学习....

bbbbbb888888 2007-07-20
  • 打赏
  • 举报
回复
ding 1楼的
xuan.ye 2007-07-20
  • 打赏
  • 举报
回复
web.config <globalization culture="es-un" uiCulture="es-un"/>
SassyBoy 2007-07-20
  • 打赏
  • 举报
回复
study~~
sqllong 2007-07-20
  • 打赏
  • 举报
回复
mark
ilmarezhou 2007-07-20
  • 打赏
  • 举报
回复
学习....
woaiwoaiyuyu 2007-07-20
  • 打赏
  • 举报
回复
呵呵,还有这写法,学习学习
greenery 2007-07-19
  • 打赏
  • 举报
回复
不用阿
你的日期变量ToString("D")就可以了。

看一下示例
using System;
using System.Globalization;

public class MainClass {
public static void Main(string[] args) {
DateTime dt = DateTime.Now;
String[] format = {
"d", "D",
"f", "F",
"g", "G",
"m",
"r",
"s",
"t", "T",
"u", "U",
"y",
"dddd, MMMM dd yyyy",
"ddd, MMM d \"'\"yy",
"dddd, MMMM dd",
"M/yy",
"dd-MM-yy",
};
String date;
for (int i = 0; i < format.Length; i++) {
date = dt.ToString(format[i], DateTimeFormatInfo.InvariantInfo);
Console.WriteLine(String.Concat(format[i], " :" , date));
}

/** Output.
*
* d :08/17/2000
* D :Thursday, August 17, 2000
* f :Thursday, August 17, 2000 16:32
* F :Thursday, August 17, 2000 16:32:32
* g :08/17/2000 16:32
* G :08/17/2000 16:32:32
* m :August 17
* r :Thu, 17 Aug 2000 23:32:32 GMT
* s :2000-08-17T16:32:32
* t :16:32
* T :16:32:32
* u :2000-08-17 23:32:32Z
* U :Thursday, August 17, 2000 23:32:32
* y :August, 2000
* dddd, MMMM dd yyyy :Thursday, August 17 2000
* ddd, MMM d "'"yy :Thu, Aug 17 '00
* dddd, MMMM dd :Thursday, August 17
* M/yy :8/00
* dd-MM-yy :17-08-00
*/
}
}
Jinglecat 2007-07-18
  • 打赏
  • 举报
回复
// 使用特定的区域和语言文化
//
string str = "2007年7月8日";
string selectedLanguage = "zh-cn"; //
System.Globalization.CultureInfo cultureInfo = System.Globalization.CultureInfo.CreateSpecificCulture(selectedLanguage);
DateTime dt = Convert.ToDateTime(str, cultureInfo);
selectedLanguage = "en-us"; //
cultureInfo = System.Globalization.CultureInfo.CreateSpecificCulture(selectedLanguage);
Console.Write(dt.ToString("m", cultureInfo));
xwk789xwk 2007-07-18
  • 打赏
  • 举报
回复
顶一下
Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-GB");
这行确实可以实现啊
紫气东来_999 2007-07-18
  • 打赏
  • 举报
回复
string str = "2007年7月8日";
DateTime dt = Convert.ToDateTime( str );
dt=string.Format("{0:R}",dt);


紫气东来_999 2007-07-18
  • 打赏
  • 举报
回复
Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-GB");
楼上这行好强
真相重于对错 2007-07-18
  • 打赏
  • 举报
回复
string str = "2007年7月8日";
DateTime dt = Convert.ToDateTime( str );
Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-GB");
string res = dt.ToString("m");

110,539

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧