本文介绍了如何转换日期的话吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要转换日期在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");
这篇关于如何转换日期的话吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!