20025.html

来自「VB技巧问答10000例,是一个教程」· HTML 代码 · 共 23 行

HTML
23
字号
<html>  <head>    <title>Re: 日期的问题????????????</title>  </head>  <body bgcolor="#FFFFFF" vlink="#808080">    <center>      <h1>Re: 日期的问题????????????</h1>    </center><hr size=7 width=75%><hr size=7 width=75%><p>Posted by <a href="mailto:whfan@isnis.com.tw">John</a> on October 12, 1999 at 11:13:48:<p>In Reply to: <a href="20016.html">日期的问题????????????</a> posted by mirice on October 12, 1999 at 09:40:54:<p>: 我想在报表上,显示每月份的1号和最后号,不知如何写出。<p>每个月的1号都是固定的,而每月的最后一天不是固定的,如闰年的2月就不固定,因此可以用dateadd涵数去计算每月的最后一天<p>以下的程式不保证可以执行,只是提供观念<br>宣告一个变数txtYear为年<br>只要输入某一西元年,阵列就可以存放月的第一天及最后一天<p>dim i as integer<br>dim txtYear as string<br>dim MonthFirth(12) as string '存放每月的第一天阵列<br>dim MonthLast(12) as string'存放每月的最后一天阵列<p>for i=0 to 11<br>if i=0 then<br>  MonthFirth(i)=txtYear+"01/01" '每年的一月1号<br>  MonthLath(i)=txtYear+"12/31"  '每年的一月31号<br>else<br>  '以每年的1/1去计算另外11个月的1号<br>  MonthFirth(i)=dateadd("m",i,txtYear+"/01/01") <br>  '以每年的1/31去计算另外11个月的最后一天<br>  MonthLast(i)=dateadd("m",i,txtYear+"01/31)<br>end if<br>next<p><br><br><hr size=7 width=75%><p><a name="followups">Follow Ups:</a><br><ul><!--insert: 20025--></ul><!--end: 20025--><br><hr size=7 width=75%><p></body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?