Date & Time Functions
Date and Time Functions in FlowOn Logic allow you to manipulate and work with date and time values. These functions enable you to perform various operations, such as formatting dates, calculating time differences, and extracting specific date components. With Date and Time Functions, you can efficiently manage and analyze date and time-related data within your functions.
Add Days
This function allows you to add days to a specific valid timestamp.
AddDays('<Timestamp>', '<Number of Days>')
| Parameter | Required | Type | Description |
|---|---|---|---|
| Timestamp | Yes | DateTime | The timestamp to which days will be added. |
| Number of Days | Yes | Integer | The number of days to add. |
| Return value | DateTime | The new timestamp after adding the days. |
- Example
AddDays("09/03/2023 03:56 PM", 2)
Result: "09/05/2023 03:56 PM"
Add Hours
This function allows you to add hours to a specific valid timestamp.
AddHours('<Timestamp>', '<Number of Hours>')
| Parameter | Required | Type | Description |
|---|---|---|---|
| Timestamp | Yes | DateTime | The timestamp to which hours will be added. |
| Number of Hours | Yes | Integer | The number of hours to add. |
| Return value | DateTime | The new timestamp after adding the hours. |
- Example
AddHours("09/03/2023 12:00:00 PM", 5)
Result: "09/03/2023 05:00:00 PM"
Add Minutes
This function allows you to add minutes to a specific valid timestamp.
AddMinutes('<Timestamp>', '<Number of Minutes>')
| Parameter | Required | Type | Description |
|---|---|---|---|
| Timestamp | Yes | DateTime | The timestamp to which minutes will be added. |
| Number of Minutes | Yes | Integer | The number of minutes to add. |
| Return value | DateTime | The new timestamp after adding the minutes. |
- Example
AddMinutes("09/03/2023 12:00:00 PM", 30)
Result: "09/03/2023 12:30:00 PM"
Add Month
This function allows you to add months to a specific valid timestamp.
AddMonth('<Timestamp>', '<Number of Months>')
| Parameter | Required | Type | Description |
|---|---|---|---|
| Timestamp | Yes | DateTime | The timestamp to which months will be added. |
| Number of Months | Yes | Integer | The number of months to add. |
| Return value | DateTime | The new timestamp after adding the months. |
- Example
AddMonth("09/03/2023 10:00:00 AM", 1)
Result: "09/03/2023 10:00:00 AM"
Add Seconds
This function allows you to add seconds to a specific valid timestamp.
AddSeconds('<Timestamp>', '<Number of Seconds>')
| Parameter | Required | Type | Description |
|---|---|---|---|
| Timestamp | Yes | DateTime | The timestamp to which seconds will be added. |
| Number of Seconds | Yes | Integer | The number of seconds to add. |
| Return value | DateTime | The new timestamp after adding the seconds. |
- Example
AddSeconds("09/03/2023 12:00:00 PM", 20)
Result: "09/03/2023 12:00:20 PM"
Add Years
This function allows you to add years to a specific valid timestamp.
AddYears('<Timestamp>', '<Number of Years>')
| Parameter | Required | Type | Description |
|---|---|---|---|
| Timestamp | Yes | DateTime | The timestamp to which years will be added. |
| Number of Years | Yes | Integer | The number of years to add. |
| Return value | DateTime | The new timestamp after adding the years. |
- Example
AddYears("09/03/2023 12:30:20 PM", 2)
Result: "09/03/2025 12:30:20 PM"
UTC To Time Zone
This function allows you to convert a timestamp from UTC to the target time zone.
UTCToTimeZone('<Timestamp>', '<TargetTimeZone>')
| Parameter | Required | Type | Description |
|---|---|---|---|
| Timestamp | Yes | DateTime | The UTC timestamp to be converted. |
| TargetTimeZone | Yes | String | The target time zone. |
| Return value | DateTime | The converted timestamp in the target time zone. |
- Example
UTCToTimeZone("09/03/2023 12:00:00 PM", "EDT")
Result: "09/03/2023 08:00:00 AM EDT"
Convert Time Zone
This function allows you to convert a timestamp from the source time zone to the target time zone.
ConvertTimeZone('<Timestamp>', '<SourceTimeZone>', '<TargetTimeZone>')
| Parameter | Required | Type | Description |
|---|---|---|---|
| Timestamp | Yes | DateTime | The timestamp in the source time zone. |
| SourceTimeZone | Yes | String | The source time zone. |
| TargetTimeZone | Yes | String | The target time zone. |
| Return value | DateTime | The converted timestamp in the target time zone. |
- Example
ConvertTimeZone("09/03/2023 12:00:00 PM", "EDT", "PDT")
Result: "09/03/2023 09:00:00 AM PDT"
Time Zone To UTC
This function allows you to convert a timestamp from the target time zone to UTC.
TimeZoneToUTC('<Timestamp>', '<SourceTimeZone>')
| Parameter | Required | Type | Description |
|---|---|---|---|
| Timestamp | Yes | DateTime | The timestamp in the source time zone. |
| SourceTimeZone | Yes | String | The source time zone. |
| Return value | DateTime | The converted UTC timestamp. |
- Example
TimeZoneToUTC("11/03/2023 12:00:00 PM", "EST")
Result: "11/03/2023 05:00:00 PM UTC"
Parse Timestamp From String
This function allows you to extract a timestamp from the provided string.
ParseTimestampFromString('<String>')
| Parameter | Required | Type | Description |
|---|---|---|---|
| String | Yes | String | The string containing the timestamp. |
| Return value | DateTime | The extracted timestamp. |
- Example
ParseTimestampFromString("The event is on 09/09/2023 10:00:00 PM")
Result: "09/09/2023 10:00:00 PM"
Start Of Day
This function returns the start of the day for a timestamp.
StartOfDay('<Timestamp>')
| Parameter | Required | Type | Description |
|---|---|---|---|
| Timestamp | Yes | DateTime | The timestamp for which the start of the day is needed. |
| Return value | DateTime | The timestamp representing the start of the day. |
- Example
StartOfDay("09/03/2023 12:45:00 PM")
Result: "09/03/2023 00:00:00 AM"
Start Of Hour
This function returns the start of the hour for a timestamp.
StartOfHour('<Timestamp>')
| Parameter | Required | Type | Description |
|---|---|---|---|
| Timestamp | Yes | DateTime | The timestamp for which the start of the hour is needed. |
| Return value | DateTime | The timestamp representing the start of the hour. |
- Example
StartOfHour("09/03/2023 12:45:00 PM")
Result: "09/03/2023 12:00:00 PM"
Start Of Month
This function returns the start of the month for a timestamp.
StartOfMonth('<Timestamp>')
| Parameter | Required | Type | Description |
|---|---|---|---|
| Timestamp | Yes | DateTime | The timestamp for which the start of the month is needed. |
| Return value | DateTime | The timestamp representing the start of the month. |
- Example
StartOfMonth("08/04/2023 12:45:00 PM")
Result: "08/01/2023 12:45:00 PM"
Get Current UTC Timestamp
This function allows you to get the current timestamp in UTC format.
GetCurrentUTCTimestamp()
| Parameter | Required | Type | Description |
|---|---|---|---|
| Return value | DateTime | The current timestamp in UTC format. |
- Example
GetCurrentUTCTimestamp()
Result: "09/03/2023 12:45:00 PM" # Example output
Get Day from Timestamp
This function allows you to get the day component as a number from a timestamp.
GetDayFromTimestamp('<Timestamp>')
| Parameter | Required | Type | Description |
|---|---|---|---|
| Timestamp | Yes | DateTime | The timestamp from which the day component is extracted. |
| Return value | Integer | The day component as a number. |
- Example
GetDayFromTimestamp("09/03/2023 12:45:00 PM")
Result: 3
Get Day Difference
This function allows you to get the difference in days as a number between two timestamps.
GetDayDifference('<Timestamp1>', '<Timestamp2>')
| Parameter | Required | Type | Description |
|---|---|---|---|
| Timestamp1 | Yes | DateTime | The first timestamp. |
| Timestamp2 | Yes | DateTime | The second timestamp. |
| Return value | Integer | The difference in days between the two timestamps. |
- Example
GetDayDifference("09/03/2023", "09/10/2023")
Result: 7
Get Day Of Week
This function allows you to get the number of the day from the week.
GetDayOfWeek('<Timestamp>')
| Parameter | Required | Type | Description |
|---|---|---|---|
| Timestamp | Yes | DateTime | The timestamp from which the day of the week is required. |
| Return value | Integer | The number representing the day of the week. |
- Example
GetDayOfWeek("09/03/2023")
Result: 7
Get Month
This function allows you to get the month component as a number from a timestamp.
GetMonth('<Timestamp>')
| Parameter | Required | Type | Description |
|---|---|---|---|
| Timestamp | Yes | DateTime | The timestamp from which the month component is required. |
| Return value | Integer | The month component of the timestamp. |
- Example
GetMonth("11/03/2023")
Result: 11
Get Month Difference
This function allows you to get the difference in months as a number between two timestamps.
GetMonthDifference('<Timestamp1>', '<Timestamp2>')
| Parameter | Required | Type | Description |
|---|---|---|---|
| Timestamp1 | Yes | DateTime | The first timestamp. |
| Timestamp2 | Yes | DateTime | The second timestamp. |
| Return value | Integer | The difference in months between the two timestamps. |
- Example
GetMonthDifference("09/03/2023", "12/03/2023")
Result: 3
Get Ticks From Timestamp
This function allows you to get the tick property value from a timestamp.
GetTicksFromTimestamp('<Timestamp>')
| Parameter | Required | Type | Description |
|---|---|---|---|
| Timestamp | Yes | DateTime | The timestamp from which the tick value is required. |
| Return value | Long | The tick value of the timestamp. |
- Example
GetTicksFromTimestamp("09/03/2023 12:45:00 PM")
Result: 6.38293419
Get Year
This function allows you to get the year component as a number from a timestamp.
GetYear('<Timestamp>')
| Parameter | Required | Type | Description |
|---|---|---|---|
| Timestamp | Yes | DateTime | The timestamp from which the year component is required. |
| Return value | Integer | The year component of the timestamp. |
- Example
GetYear("09/03/2027")
Result: 2027
Get Year Difference
This function allows you to get the difference in years as a number between two timestamps.
GetYearDifference('<Timestamp1>', '<Timestamp2>')
| Parameter | Required | Type | Description |
|---|---|---|---|
| Timestamp1 | Yes | DateTime | The first timestamp. |
| Timestamp2 | Yes | DateTime | The second timestamp. |
| Return value | Integer | The difference in years between the two timestamps. |
- Example
GetYearDifference("09/03/2023", "01/01/2029")
Result: 6
What's Next
In this section, we've explored various date and time functions in FlowOn logic and learned how to apply them effectively. In the next section, we'll delve into Math functions for further understanding and application.