从指定日期中获取部分数据: 如月份: select to_CHAR(sysdate,'MM') FROM DUAL; 或者: select extract(month from sysdate) from dual; 又或者最笨的方法.用to_char()先把日期转化为指定格式的字符串,在通过substr()这个取到想要的数据. select substr(to_char(sysdate,'yyyy-mm-dd'),6,2) from dual; 获取日期其他部分数据和上方法一样.…
NthDayOfWeek 计算并返回指定日期是该月第几周 Unit:DateUtils function NthDayOfWeek(const AValue: TDateTime): Word; Example: Uses SysUtils,DateUtils; Begin Write('Today is the ',NthDayOfWeek(Today),'-th '); Writeln(formatdateTime('dddd',Today),' of the month.');En…
var d = new Date(); d.setDate(d.getDate() - 2); console.log(d.toString()); // First of month var c = new Date(2017,1,1); // 1 Feb -> 30 Jan c.setDate(c.getDate() - 2); console.log(c.toString()); // First of year var b = new Date(2018,0,1); // 1 Jan -…