VBGood网站全文搜索 Google

首页 - 经验之谈 - 查找月份的最后一天
发表评论(0)作者:不详, 平台:VB6.0+Win98, 阅读:9726, 日期:2000-10-18
In many industries (particularly in the insurance industry), it注释:s important to know the last day of the month. To find the last day of a given month, add a text box and a command button to a form. Enter the following code in the command button:

Dim TEMP2 As Date
Dim nLastDay As Integer
TEMP2 = InputBox$("Please Enter A Date", "LastDay")
nLastDay = DatePart("d", DateAdd("M", 1, TEMP2 - DatePart("d", TEMP2)))
Text1.Text = nLastDay
When you run the application and click the button, you注释:ll be prompted for a date. Then, the program will display the last day of that month of any year.