Intro
Below is a comprehensive list of Date and Time data formatters available in App Connect (client-side), accompanied by explanations outlining the purpose and functionality of each.
Date and Time Formatters
Get Year:
- Returns the year from a given date value.
- Example:
('2024-05-10').getYear()returns2024
Get Month:
- Returns the month number (1–12) from a date.
- Example:
('2024-05-10').getMonth()returns5
Get Date:
- Returns the day of the month.
- Example:
('2024-05-10').getDate()returns10
Get Day:
- Returns the weekday number (0–6).
- Example:
('2024-05-10').getDay()returns5
Get Hours:
- Returns the hour value.
- Example:
('2024-05-10 14:30').getHours()returns14
Get Minutes:
- Returns the minute value.
- Example:
('2024-05-10 14:30').getMinutes()returns30
Get Seconds:
- Returns the seconds value.
- Example:
('2024-05-10 14:30:15').getSeconds()returns15
Get Milliseconds:
- Returns the milliseconds value.
- Example:
('2024-05-10 14:30:15.250').getMilliseconds()returns250
Add Years:
- Adds a number of years to a date.
- Example:
('2024-05-10').addYears(2)returns a date in 2026
Add Months:
- Adds a number of months to a date.
- Example:
('2024-05-10').addMonths(1)returns a date in June
Add Weeks:
- Adds a number of weeks to a date.
- Example:
('2024-05-10').addWeeks(2)returns a date two weeks later
Add Days:
- Adds a number of days to a date.
- Example:
('2024-05-10').addDays(5)returns a later date
Add Hours:
- Adds hours to a date.
- Example:
('2024-05-10 10:00').addHours(3)returns13:00
Add Minutes:
- Adds minutes to a date.
- Example:
('2024-05-10 10:00').addMinutes(30)returns10:30
Add Seconds:
- Adds seconds to a date.
- Example:
('2024-05-10 10:00').addSeconds(15)returns later seconds
Add Milliseconds:
- Adds milliseconds to a date.
- Example:
('2024-05-10').addMilliseconds(500)returns updated time
Years Until:
- Returns the number of years between two dates.
- Example:
('2020-01-01').yearsUntil('2024-01-01')returns4
Months Until:
- Returns the number of months between two dates.
- Example:
('2024-01-01').monthsUntil('2024-06-01')returns5
Weeks Until:
- Returns the number of weeks between two dates.
- Example:
('2024-01-01').weeksUntil('2024-02-01')returns4
Days Until:
- Returns the number of days between two dates.
- Example:
('2024-01-01').daysUntil('2024-01-10')returns9
Hours Until:
- Returns the number of hours between two dates.
- Example:
('2024-01-01 10:00').hoursUntil('2024-01-01 15:00')returns5
Minutes Until:
- Returns the number of minutes between two dates.
- Example:
('2024-01-01 10:00').minutesUntil('2024-01-01 10:30')returns30
Seconds Until:
- Returns the number of seconds between two dates.
- Example:
('2024-01-01 10:00:00').secondsUntil('2024-01-01 10:00:10')returns10
Milliseconds Until:
- Returns the number of milliseconds between two dates.
- Example:
('2024-01-01').millisecondsUntil('2024-01-01.500')returns500
Time Until:
- Returns formatted time difference between two dates (mm:ss or hh:mm:ss).
- Example:
('10:00').timeUntil('10:05')returns5:00
Format Date:
- Formats a date using a custom format string (year, month names, time, etc).
- Example:
('2024-05-10').formatDate('YYYY-MM-DD')returns2024-05-10