Skip to end of banner
Go to start of banner

startOfMonth

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Availability

This routine is available since katl-commons 2.5.5

Syntax:

startOfMonth(date)

Description:

Returns a date set on the first day of the month for the given date. Also sets hours/minutes/seconds to 0.

Parameters:

Parameter name

Type

Required

Description

date

date

Yes

Specifies a Date expression

Return type:

date

Example:

function startOfMonthToDesc(date d){
    desc += "Start of month for date " + d + " is " + startOfMonth(d) + "\n";
}

desc = "";
startOfMonthToDesc("2013-01-26 20:19:18");
startOfMonthToDesc("2013-02-01 20:19:18");
startOfMonthToDesc("2013-02-28 20:19:18");
startOfMonthToDesc("2012-02-29 20:19:18");
startOfMonthToDesc("2012-12-31 23:59:59");
startOfMonthToDesc("2012-12-01 23:59:59");
startOfMonthToDesc("2012-12-01 00:00:00");

Outputs to description:

Start of month for date 2013-01-26 20:19:18 is 2013-01-01 00:00:00

Start of month for date 2013-02-01 20:19:18 is 2013-02-01 00:00:00

Start of month for date 2013-02-28 20:19:18 is 2013-02-01 00:00:00

Start of month for date 2012-02-29 20:19:18 is 2012-02-01 00:00:00

Start of month for date 2012-12-31 23:59:59 is 2012-12-01 00:00:00

Start of month for date 2012-12-01 23:59:59 is 2012-12-01 00:00:00

Start of month for date 2012-12-01 00:00:00 is 2012-12-01 00:00:00

See Also:

 

  • No labels