Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
所以我有一个这种格式的日期 2012 年 11 月 20 日,我想做的是减去一周的时间,然后在 2012 年 11 月 13 日回来我试过这个:DateAdd("ww", -1, DatePart("d", Date) & "-" & MonthName(DatePart("m", Date), 1) & "-" & DatePart("yyyy", Date) )
DateAdd("ww", -1, DatePart("d", Date) & "-" & MonthName(DatePart("m", Date), 1) & "-" & DatePart("yyyy", Date) )
但我得到了错误的日期格式:13/12/2012 有什么想法吗?
格式化进入 DateAdd 函数的日期可能不会影响输出。尝试类似:
weekEarlier=DateAdd("ww", -1, Date) document.write(DatePart("d", weekEarlier) & "-" & MonthName(DatePart("m", weekEarlier), 1) & "-" & DatePart("yyyy", weekEarlier))