从“2014年8月”获取月份编号串 [英] Get month Number from "Aug 2014" string
本文介绍了从“2014年8月”获取月份编号串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要字符串文本中的月号。
ex:来自2014年8月,我应该得到8,若2014年7月则为7.
谢谢,
Hi,
I need month number from string text.
ex: from "Aug 2014" , I should get 8, if "Jul 2014" then 7.
thanks,
推荐答案
看到:
See this :
int month = DateTime.ParseExact("Aug 2014", "MMM yyyy", CultureInfo.InvariantCulture).Month;//month will be 8 in this case
添加对的引用System.Globalization
问候..
Add reference to System.Globalization
Regards..
请参阅以下链接
如何显示月份数 - 选择月份名称 [ ^ ]
希望它会有所帮助..
Refer below link
how-to-display-month-number-on-selecting-month-name[^]
Hope it will help..
这篇关于从“2014年8月”获取月份编号串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文