6

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,

Fehr Benjamin
  • 62
  • 1
  • 11
  • Please check the expect result you want, in your question you want `20200601154151`, this leads to confuse. Do you want `20200601154115` ? or `2020060115411551` ? – Hury Shen Jun 02 '20 at 07:16
  • hi and welcome, look in to using regex to replace values in string https://medium.com/plumsail/how-to-use-match-test-replace-regular-expressions-in-microsoft-flow-and-azure-logic-apps-and-84e6cb848e86 – Darkmage Jun 05 '20 at 13:08

1 Answers1

8

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.

Joel Cochran
  • 7,139
  • 2
  • 30
  • 43