time y$, m$, d$, h$, n$, s$
ny=val(y$)
nm=val(m$)
nd=val(d$)
! 1月なら前月は12月
if nd=1 then
if nm=1 then
zm=12
zy=ny-1
else
zm=nm-1
zy=ny
endif
else
zm=nm
zy=ny
end if
! 1日 なら前月月末日を取得
if nd=1 then
if zm=1 then
zd=31
endif
if zm=2 then
zd=28 ←閏年無視
endif
if zm=3 then
zd=31
endif
(中略)
if zm=12 then
zd=31
endif
else
zd=nd-1
endif
!文字型にしたときに.0が入ってしまうための処理
zyy$=replace$(str$(zy),".0","")
if len(zyy$)=1 then
zyy$="0"+zyy$
endif
zmm$=replace$(str$(zm),".0","")
if len(zmm$)=1 then
zmm$="0"+zmm$
endif
zdd$=replace$(str$(zd),".0","")
if len(zdd$)=1 then
zdd$="0"+zdd$
endif