Formatting logic app expression for DateTime

Viewed 7295

I am generating a file for export with the file name utcnow in the logic app expression which returns a value like this

utcNow()- "2020-06-01T15:41:15.5103915Z" I want to convert it like "20200601154151" that means I need to remove some characters like" -","T" and millisecondsfollwed by Z, I tried few combination of string format and I am not getting it right hoping you guys to help me. Thanks,

1 Answers

There are many options for custom date formats. Here is a simple guide:

  • yyyy = Year (2020)
  • MM = Month (06)
  • dd = Day (01)
  • HH = Hour (15)
  • mm = Minute (41)
  • ss = Second (15)

Construct a format string (ex: yyyyMMddHHmmss) based on your requirements and pass it to formatDateTime:

formatDateTime(utcNow(), 'yyyyMMddHHmmss')

The resulting value will be '20200601154115'. There are many additional options at the link above.

Related