pdk.util.Date

functions to operate with dates

Functions


addDays

Adds or subtracts the specified amount of days to the date object, based on the calendar's rules.

Arguments:

Result:

Possible exceptions


addHours

Adds or subtracts the specified amount of hours to the date object, based on the calendar's rules.

Arguments:

Result:

Possible exceptions


addMilliseconds

Adds or subtracts the specified amount of milliseconds to the date object, based on the calendar's rules.

Arguments:

Result:

Possible exceptions


addMinutes

Adds or subtracts the specified amount of minutes to the date object, based on the calendar's rules.

Arguments:

Result:

Possible exceptions


addMonths

Adds or subtracts the specified amount of months to the date object, based on the calendar's rules.

Arguments:

Result:

Possible exceptions


addSeconds

Adds or subtracts the specified amount of seconds to the date object, based on the calendar's rules.

Arguments:

Result:

Possible exceptions


addWeeks

Adds or subtracts the specified amount of weeks to the date object, based on the calendar's rules.

Arguments:

Result:

Possible exceptions


addYears

Adds or subtracts the specified amount of years to the date object, based on the calendar's rules.

Arguments:

Result:

Possible exceptions


after

Returns whether the first argument represents a time after the time represented by the second argument.

Arguments:

Result:

  • output :: pdk.core.Boolean - true if the time of the first argument is after the time represented by the second argument; false otherwise.

Possible exceptions


before

Returns whether the first argument represents a time before the time represented by the second argument.

Arguments:

Result:

  • output :: pdk.core.Boolean - true if the time of the first argument is before the time represented by the second argument; false otherwise.

Possible exceptions


currentDate

Returns a Date object representing the current time value (UTC).

Arguments:

  • no

Result:


difference

Returns the difference between two dates by specified field. If the difference is more then N and less then N+1, then N is a result. For example, if you had the date of 25 May 2020 12:34:56.345 and 27 May 2020 16:10:12.300, if you passed with 3 (Day), it would return 2. If this was passed with 1 (Year), it would return 0. Fields indicators:

Field indicatorValue

Year

1

Month

2

Day

3

Hour

4

Minute

5

Second

6

Arguments:

Result:

Possible exceptions


getDaysCountInMonth

Returns the amount of days for specified year and month.

Arguments:

Result:

Possible exceptions


getDaysCountInYear

Returns the amount of days for specified yer.

Arguments:

Result:

Possible exceptions


getDayOfYear

Returns the value that indicates the day number within the data year.

Arguments:

Result:

Possible exceptions


getDayOfMonth

Returns the value that indicates the day number within the data month.

Arguments:

Result:

Possible exceptions


getDayOfWeek

Returns the value that indicates the day number within the data week.

Arguments:

Result:

Possible exceptions


getFirstDayOfMonth

Returns the first day of the specified month.

DayValue

Sunday

1

Monday

2

Tuesday

3

Wednesday

4

Thursday

5

Friday

6

Saturday

7

Arguments:

Result:

Possible exceptions


getFirstDayOfYear

Returns the first day of the specified year

DayValue

Sunday

1

Monday

2

Tuesday

3

Wednesday

4

Thursday

5

Friday

6

Saturday

7

Arguments:

Result:

Possible exceptions


getHour

Returns the value that indicates the hour of the morning or afternoon. NOTE value is in 12 hours format.

Arguments:

Result:

Possible exceptions


getHourOfDay

Returns the value that indicates the hour of the day.

Arguments:

Result:

Possible exceptions


getMillisecond

Returns the value that indicates the millisecond within the second.

Arguments:

Result:

Possible exceptions


getMinute

Returns the value that indicates the minute within the hour.

Arguments:

Result:

Possible exceptions


getMonth

Returns the value that indicates the month within the year.

The value returned is between 1 and 12, with the value 1 representing January.

Arguments:

Result:

Possible exceptions


getSecond

Returns the value that indicates the second within the minute.

Arguments:

Result:

Possible exceptions


getTimeInMills

The currently set time for the argument date, expressed in milliseconds after January 1, 1970, 0:00:00 GMT.

Arguments:

Result:

Possible exceptions


getWeekOfMonth

Returns the value that indicates the week number within the argument date month.

Arguments:

Result:

Possible exceptions


getWeekOfYear

Returns the value that indicates the week number within the argument date year.

Arguments:

Result:

Possible exceptions


getYear

Returns the value that indicates the argument year.

Arguments:

Result:

Possible exceptions


fromString

Parses text from the beginning of the given string to produce a date. Arguments:

  1. String - the string to be converted.

  2. String - the format of the date represented by the string.

Format examples:

Date and Time PatternResult

"yyyy-MM-dd"

2001-07-04T00:00:00Z

"yyyy-MM-dd'T'HH:mm:ss"

2001-07-04T12:08:56

Arguments:

Result:

Possible exceptions


isSameDay

Checks if two date objects are on the same day ignoring time. 05 May 2020 11:00 and 05 May 2020 23:45 would return true. 05 May 2020 11:00 and 10 May 2020 14:30 would return false.

Arguments:

Result:

Possible exceptions


truncate

Truncates a date, leaving the field specified as the most significant field. For example, if you had the date-time of 05 May 2020 12:34:56.345, if you passed with 4 (Hour), it would return 05 May 2020 12:00:00.000. If this was passed with 2 (Month), it would return 1 May 2020 0:00:00.000.

Field indicatorValue

Year

1

Month

2

Day

3

Hour

4

Minute

5

Second

6

Arguments:

Result:

Possible exceptions


round

Rounds a date, leaving the field specified as the most significant field. For example, if you had the date-time of 25 May 2020 12:34:56.345, if you passed with 4 (Hour), it would return 05 May 2020 13:00:00.000. If this was passed with 2 (Month), it would return 1 August 2020 0:00:00.000.

Field indicatorValue

Year

1

Month

2

Day

3

Hour

4

Minute

5

Second

6

Arguments:

Result:

Possible exceptions

Last updated