pdate()

Read(2358) Label: the first day, the last day,

Description:

Get the first day or the last day of the week/month/quarter/year to which a date belongs.

Syntax:

pdate (dateExp)

Note:

The function gets the first day or the last day of the week/month/quarter/year to which the date dateExp belongs.

Parameter:

dateExp

Expression whose result is a date, or of standard date format

Option:

@w

Take Sunday as the first day of a week and get the first day of the week to which dateExp belongs; this is the default option of pdate() function

@1

Work with @w option and take Monday as the first day of a week; note that it is number 1 that is used here

@m

Get the first day of the month to which dateExp belongs

@q

Get the first day of the quarter to which dateExp belongs

@y

Get the first day of the year to which dateExp belongs

@e

Work with another option to get the last day

Return value:

Datetime type

Example:

pdate@w(datetime("19800227","yyyyMMdd"))

1980-02-24; get the first day of the week to which the parameter belongs.

pdate@we (datetime("19800227","yyyyMMdd"))

1980-03-01; get the last day of the week to which the parameter belongs.

pdate@w1(datetime("19800227","yyyyMMdd"))

1980-02-25; take Monday as the first day of a week and get the first day of the week to which the parameter belongs.

pdate@m(datetime("19800227","yyyyMMdd"))

1980-02-01; get the first day of the month to which the parameter belongs.

pdate@me(datetime("19800227","yyyyMMdd"))

1980-02-29; get the last day of the month to which the parameter belongs.

pdate@q(datetime("19800227","yyyyMMdd"))

1980-01-01; get the first day of the quarter to which the parameter belongs.

pdate@qe(datetime ("19800227","yyyyMMdd"))

1980-03-31; get the last day of the month to which the parameter belongs.

pdate@y(datetime("19800227","yyyyMMdd"))

1980-01-01; get the first day of the year to which the parameter belongs.

pdate@ye(datetime("19800227","yyyyMMdd"))

1980-12-31; get the last day of the month to which the parameter belongs.