Service Manager

Home 

DatePart

This function will be deprecated in a future release, so use it with caution.

However, it is still supported for existing expressions, so it has not been removed from the application. Editing an expression using this function can cause an error message to appear.

Instead of this function, use LocalYear, LocalQuarter, LocalMonth, LocalWeek, LocalDay, LocalHour, LocalMinute, or LocalSecond.

Returns the requested part (such as day, second, or quarter) of the local date.

The weekday type of the part parameter now returns the name of the weekday, such as Monday or Tuesday, instead of a number representing the weekday, such as 1 or 2.  This is a functional change and may break existing usages.

Syntax

DatePart(part,date)

Enabled For

For a description of the business object categories, see Notes on "Enabled For".

Business Object Category Yes/No
Business Rules: Before-Save Rules Yes
Business Rules: Calculation Rules (After Save, with or without Also Recalculate on Load) Yes
Business Rules: Calculation Rules (Before Save or Always, without Also Recalculate On Load) Yes
Business Rules: Calculation Rules (Before Save or Always, with Recalculate On Load) Yes
Business Rules: Editing Rules Yes
Business Rules: Initialization Rules Yes
Business Rules: Read Only Rules Yes
Business Rules: Required Rules Yes
Business Rules: Validation Rules Yes
Client Expressions Yes
Object Permissions Yes
Services Yes
LDAP Yes
Mobile Yes
Quick Actions (except UI Quick Actions) Yes
UI Quick Actions Yes
Reports Yes
Search/Dashboard without field references Yes
Search/Dashboard with field references Yes

Parameters

part

The part of the day to return. Must be surrounded by quotes (" "). The following types are supported:

millisecond

second

minute

hour

day

weekday: Sunday through Saturday

dayofyear: 1 through 365/366

month: 1 through 12

quarter: 1 through 4

year

date

The date for which to return a part.

Return Value

Number value.

Example

$(DatePart("day",CreatedDate()))

If the value of the CreatedDate() function is Dec 9, 2013, this example returns 9 because the input has 9 for the value of the day.

Another example:

DatePart() Example


Was this article useful?