dpart()

Function group Execute on client Platform(s)
Date and Time NO All

Syntax

dpart(datepart,date)

Description

Returns a number that represents a part of the specified date depending on the datepart constant used.

This is useful when you want to know the week number (that is, the week of the year; use kWeek), the day of the year or the day of the week, and so on. 

The datepart constants that you can use are: kYear, kMonth, kWeek, kDayofYear, kQuarter, kMonthofQuarter, kWeekofQuarter, kDayofQuarter, kWeekofMonth, kDay, kDayofWeek, kHour, kMinute,kSecond, kCentiSecond.

When this function returns the week of the year (kWeek) the calculation is based on 1 Jan being the first day of the first week of the year, the last day of the year is week 53.

Example

Calculate lDate as dpart(kWeek,#D)
; returns 19, the week number, assume #D is May 8, 2003


Calculate lDate as dpart(kMonth,#D)
; returns 5, the month number, assume #D is May 8, 2003