+ -
当前位置:首页 → 问答吧 → VB编程?输入一个日期,计算出该日期下一个月的最后一天

VB编程?输入一个日期,计算出该日期下一个月的最后一天

时间:2011-11-29

来源:互联网

1. Calculate the last day of Next month
  Input: a date (including: year, month, day)
  Output: last day of next month (including: year,month, day)
  E.g. input: ; output: 2010/11/30
2. Test your program systemically. Write your testing cases

1.人手输入任何一个日期(包括:year,month,day)
2.输出该日期下一个月的最后一天
3.日期格式例例子:2010/10/15


求高手帮忙写一个完整的程序,谢谢各位了。

作者: xijojo   发布时间: 2011-11-29

Dim a as string
 a=dateadd("m",2,YourInputdate)
 a=dateadd("d",-1,a)
 a=format(a,"yyyy/MM/dd")

作者: applekiller   发布时间: 2011-11-29


private function GetNextLast(d as date) as date

dim y as long
dim m as long
d="2011-11-3"
y=year(d)
m=month(d)

select case m
case 11
 GetNextLast=cstr(y)& "-12-31")
case 12
 GetNextLast=cstr(y+1)& "-1-31")
case else
GetNextLast=cdate(cstr(y)&"-"& cstr(m+2) &"-1"))-1
end select
end function

作者: worldy   发布时间: 2011-11-29

热门下载

更多