如何转换日期的话吗?的话、日期

由网友(很酷不撩妹)分享简介:我要转换日期在Vb.net英语单词。例如:2008年5月26日至第二十六届2008年5月I want to convert date in english words in Vb.net.For example: 26 May,2008 to Twenty sixth May 2008会是怎样最好approch...

我要转换日期在Vb.net英语单词。 例如:2008年5月26日至第二十六届2008年5月

I want to convert date in english words in Vb.net. For example: 26 May,2008 to Twenty sixth May 2008

会是怎样最好approch,在日期时间数据类型的任何函数存在?

What will be best approch, is any function in datetime data type exists?

推荐答案

这可能是最好的办法: -

This probably the best approach:-

private static string[] dayText = new string[]
{"First", "Second", "Third", "Fourth", "Fifth", "Sixth", "Seventh", "Eighth",
 "Nineth", "Tenth", "Eleventh", "Twelveth", "Thirteenth", "Fourteenth", "Fifteenth",
  "Sixteenth", "Seventeenth", "Eighteenth", "Nineteenth", "Twentieth", "Twenty first",
 "Twenty second", "Twenty third", "Twenty fourth", "Twenty fifth", "Twenty sixth",
 "Twenty seventh", "Twenty eighth", "Twenty nineth", "Thirtieth", "Thirty first"};

public static string DayInWords(int day)
{
    //assertion code here
    return dayText[day-1];
}

...
string result = DayInWords(myDate.Day) + myDate.ToString(" MMM yyyy");
阅读全文

相关推荐

最新文章