2.5.3 Extracting a Date Component

When extracting calendar elements within a date (year, month, quarter, etc.) use the date functions within the CALC function library. For example:

//extracting the current date and time

var todDate = CALC.today(); //e.g., Feb-21-2007

 

//extracting the year

var y = CALC.year(todDate); // 2007

 

//extracting the quarter

var q = CALC.quarter(todDate); // 1

 

//extracting the day of the week

var dow = CALC.weekdayname(todDate); // Wednesday

 

//extracting the date

var d = CALC.day(todDate); // 21

 

//extracting the month

var m = CALC.month(todDate); // 2

<< 2.5.2 Calculating a Past or Future Date © 1996-2013 InetSoft Technology Corporation (v11.4) 2.5.4 Formatting a Date >>