vbaのdateをちょっと...
'今日
today = Date
'先月末
lastMonthLastDay = _
DateAdd("d", -1, DateSerial(Year(today), Month(today), 1))
'先月初
lastMonthLastDay = _
DateAdd("m", -1, DateSerial(Year(today), Month(today), 1))
'今月末
thisMonthLastDay = _
DateAdd("d", -1, DateAdd("m", 1, DateSerial(Year(today), Month(today), 1)))
'今月の日数
thisMonthDayCount = DateDiff("d",lastMonthLastDay,thisMonthLastDay)
'今日(yyyymmdd形式)
today = Format(Date,"yyyymmdd")
'今日(mysql形式)
today = Format(Date,"yyyy-mm-dd")
'今現在(mysql形式)
Format(Now, "yyyy-mm-dd hh:nn:ss")
'YYYYMMDDをDate形に変換
myDate = CDate(Format("20111231", "@@@@/@@/@@"))
0 件のコメント:
コメントを投稿