DateFormat 03/05到MAR05,怎么样? [英] DateFormat 03/05 to MAR05, how?

查看:44
本文介绍了DateFormat 03/05到MAR05,怎么样?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网格列有一个DateTime类型数据。我想在

单元格中显示它作为

MONYR,如MAR05 JAN05等。找不到DateTime格式,有没有

快速的方法(而不是将我的列类型从DateTime转换为字符串

然后自己解析)?


谢谢很多


克里斯

I have a DateTime type data for my grid column. I want to display it in the
cells as

MONYR, as MAR05 JAN05 etc. Cannot find it in DateTime format, is there any
quick way to do it (instead of convert my column type from DateTime to string
and then parse it by myself)?

Thanks a lot

Chris

推荐答案

DateTime.ToString(" MMMYY")?


(如果你想用大写字母表示月份,你可能需要做一个ToUpper)。


-

Adam Clauss
ca*****@tamu.edu


" chrisben" < CH ****** @ discussions.microsoft.com>在消息中写道

新闻:B6 ********************************** @ microsof t.com ...
DateTime.ToString("MMMYY") ?

(You may need to do a ToUpper if you want the month in capital letters).

--
Adam Clauss
ca*****@tamu.edu

"chrisben" <ch******@discussions.microsoft.com> wrote in message
news:B6**********************************@microsof t.com...
我的网格列有一个DateTime类型数据。我希望将它显示在

MONYR中,如MAR05 JAN05等。无法在DateTime格式中找到它,是否有任何快速的方法来实现它(而不是将我的列类型从DateTime转换为
字符串
然后自己解析它?

非常感谢

Chris
I have a DateTime type data for my grid column. I want to display it in the
cells as

MONYR, as MAR05 JAN05 etc. Cannot find it in DateTime format, is there any
quick way to do it (instead of convert my column type from DateTime to
string
and then parse it by myself)?

Thanks a lot

Chris



Chrisben,
http://msdn.microsoft.com/library/de...ormattopic.asp


" MMMdd"


我希望这会有所帮助


Cor
Chrisben,

http://msdn.microsoft.com/library/de...ormattopic.asp

"MMMdd"

I hope this helps

Cor


chrisben< ch ****** @ discuss.microsoft.com>写道:
chrisben <ch******@discussions.microsoft.com> wrote:
我的网格列有一个DateTime类型数据。我希望将它显示在

MONYR中,如MAR05 JAN05等。无法在DateTime格式中找到它,是否有任何快速的方法来实现它(而不是将我的列类型从DateTime转换为字符串
然后自己解析它??
I have a DateTime type data for my grid column. I want to display it in the
cells as

MONYR, as MAR05 JAN05 etc. Cannot find it in DateTime format, is there any
quick way to do it (instead of convert my column type from DateTime to string
and then parse it by myself)?




你的意思是:


使用系统;


公共类Foo

{

public static void Main()

{

DateTime dt = DateTime.Now;

Console.WriteLine(dt.ToString(" MMMyy")。ToUpper());

}

}


使用的月份名称是特定于文化的,因此可以本地化为



/ J \



You mean something like:

using System;

public class Foo
{
public static void Main()
{
DateTime dt = DateTime.Now;
Console.WriteLine(dt.ToString("MMMyy").ToUpper());
}
}

The month name used is Culture specific so is capable of being
localized.

/J\


这篇关于DateFormat 03/05到MAR05,怎么样?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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