App Connect Data Formatters - Date & Time

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() returns 2024

Get Month:

  • Returns the month number (1–12) from a date.
  • Example: ('2024-05-10').getMonth() returns 5

Get Date:

  • Returns the day of the month.
  • Example: ('2024-05-10').getDate() returns 10

Get Day:

  • Returns the weekday number (0–6).
  • Example: ('2024-05-10').getDay() returns 5

Get Hours:

  • Returns the hour value.
  • Example: ('2024-05-10 14:30').getHours() returns 14

Get Minutes:

  • Returns the minute value.
  • Example: ('2024-05-10 14:30').getMinutes() returns 30

Get Seconds:

  • Returns the seconds value.
  • Example: ('2024-05-10 14:30:15').getSeconds() returns 15

Get Milliseconds:

  • Returns the milliseconds value.
  • Example: ('2024-05-10 14:30:15.250').getMilliseconds() returns 250

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) returns 13:00

Add Minutes:

  • Adds minutes to a date.
  • Example: ('2024-05-10 10:00').addMinutes(30) returns 10: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') returns 4

Months Until:

  • Returns the number of months between two dates.
  • Example: ('2024-01-01').monthsUntil('2024-06-01') returns 5

Weeks Until:

  • Returns the number of weeks between two dates.
  • Example: ('2024-01-01').weeksUntil('2024-02-01') returns 4

Days Until:

  • Returns the number of days between two dates.
  • Example: ('2024-01-01').daysUntil('2024-01-10') returns 9

Hours Until:

  • Returns the number of hours between two dates.
  • Example: ('2024-01-01 10:00').hoursUntil('2024-01-01 15:00') returns 5

Minutes Until:

  • Returns the number of minutes between two dates.
  • Example: ('2024-01-01 10:00').minutesUntil('2024-01-01 10:30') returns 30

Seconds Until:

  • Returns the number of seconds between two dates.
  • Example: ('2024-01-01 10:00:00').secondsUntil('2024-01-01 10:00:10') returns 10

Milliseconds Until:

  • Returns the number of milliseconds between two dates.
  • Example: ('2024-01-01').millisecondsUntil('2024-01-01.500') returns 500

Time Until:

  • Returns formatted time difference between two dates (mm:ss or hh:mm:ss).
  • Example: ('10:00').timeUntil('10:05') returns 5:00

Format Date:

  • Formats a date using a custom format string (year, month names, time, etc).
  • Example: ('2024-05-10').formatDate('YYYY-MM-DD') returns 2024-05-10
2 Likes