且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

获得月份和年份

更新时间:2023-01-29 21:33:02

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. :)