Extracting a Date Component

The CALC library provides a number of functions to extract different components of a date object: year, month, day, quarter, etc.

// extract the current date and time

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

 

// extract the year

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

 

// extract the quarter

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

 

// extract the day of the week

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

 

// extract the date

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

 

// extract the month

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

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