获得月份和年份 [英] to get month and year
本文介绍了获得月份和年份的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
从字符串month ="09/02/2011"中如何提取月份和年份..plshelp
from a string month = "09/02/2011" how can i extract month and year..pls help
推荐答案
Dim dte As DateTime = ddate
昏暗的月份作为字符串= CInt(dte.Month)
Dim year As String = dte.Year
Dim dte As DateTime = ddate
Dim month As String = CInt(dte.Month)
Dim year As String = dte.Year
只是另一个信息.
您可以访问有关日期格式的链接http://codeincsharp.blogspot.com/2008/05/different-date-format-in-c.html
谢谢
Hi,
Just another info.
You can visit this link about the date format http://codeincsharp.blogspot.com/2008/05/different-date-format-in-c.html
Thank You
只需将其转换为日期时间格式
just convert it into datetime format
DateTime date = Convert.ToDateTime("09 / 02 / 2012");
int month=Convert.ToInt32(date1.Month);
int year=Convert.ToInt32(date1.Year);
这样,您可以获得月份和年份.
希望对您有帮助.
如果有帮助,别忘了将其标记为答案. :)
In this way, you can get month and year.
Hope this will help you.
And Don''t forget to mark as answer if it helps. :)
这篇关于获得月份和年份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文