{tocify} $title={Table of Contents}
Many times in the workflow we need to get the current time and use it.
One very common scenario is using current time to append it with FileName or blob name to make it unique.
In logic app there are sets of out of box functions available which we can use as per our need.
How to get current date in logic app
Simplest way is to Initialize a variable , give it a name , select the type as String (Date/DateTime type is not available) and against value - go to Expression--> Select utcNow()
Below is what you get as output, the default format.
Optionally, you can specify a different format with the <format> parameter.
yyyy = Year (2022)
MM = Month (05)
dd = Day (01)
HH = Hour (15)
mm = Minute (41)
ss = Second (15)
Apart from utcNow() function other datetime functions can be used to work with dates and times. Date and time functions available are:
startOfDay – Return the start of the day for a timestamp.
startOfHour – Return the start of the hour for a timestamp.
startOfMonth – Return the start of the month for a timestamp
addDays – Add several days to a timestamp.
addHours – Add several hours to a timestamp.
addMinutes – Add several minutes to a timestamp.
addSeconds – Add several seconds to a timestamp.
addToTime – Add several time units to a timestamp.
convertFromUtc – Convert a timestamp from Universal Time Coordinated (UTC) to the target time zone.
convertTimeZone – Convert a timestamp from the source time zone to the target time zone.
convertToUtc – Convert a timestamp from the source time zone to Universal Time Coordinated (UTC).
getFutureTime – Return the current timestamp plus the specified time units
getPastTime – Return the current timestamp minus the specified time units.
dayOfMonth – Return the day of the month component from a timestamp.
dayOfWeek – Return the day of the week component from a timestamp.
dayOfYear – Return the day of the year component from a timestamp.
subtractFromTime – Subtract several time units from a timestamp.
ticks – Return the ticks property value for a specified timestamp
formatDateTime – Return the date from a timestamp.
Learn More about Logic App
- BizTalk Developer getting started with Logic App
- Getting Started with Logic Apps - Fundamentals
- Getting Started with Logic Apps - Enterprise Application Integration
- Getting Started with Logic Apps - AS2
- Getting Started with Logic Apps - EDI X12 Fundamentals
- Getting Started with Logic Apps - XML to EDI X12
- Getting Started with Logic Apps - EDI X12 to XML
- Getting Started with Logic Apps - What happened to the Request?
- Inserting Multiple Records In On Prem SQL Using Logic App
- Inserting data in On Premises SQL Database using Logic Apps
- Installing and Configuring On Premises Data Gateway - By adding user to Active Directory
- XML Batching(Aggregation) in Logic App
- Batching(Aggregating) messages in Logic App
- Debatching(Splitting) JSON Message in Logic Apps - ForEach and SplitOn
- Debatching(Splitting) XML Message in Logic Apps - ForEach and SplitOn
- Securing Logic App with Azure Active Directory authentication
- Removing ns0: prefix from xml output from BizTalk/Logic app XSLT map
- Using Managed Identity in Logic Apps for Calling Active Directory Secured Function App
- Logic Apps : Fetching ISA and GS Segment Values From Interchange Envelope and Mapping
- Logic Apps : For Each Inside a For Each - Fetching values from field in an array inside an array