Leo
Leo

Reputation: 898

Azure Data factory not able to convert date format

I'm trying to get DAYID as string in format YYYYMMDD, however its not working correctly.

I have a timestamp field, I take first 10 characters and convert it into date (working correctly)

toDate(substring(EventTimestamp,1,10))
-- 2021-03-24

However when I try to convert to string using below expression, I;m getting wrong answer. I;m getting the Day as 83.

toString(toDate(substring(EventTimestamp,1,10)),'YYYYMMDD')
  --20210383 

Upvotes: 1

Views: 380

Answers (1)

wBob
wBob

Reputation: 14379

Date format characters are case-sensitive as per this answer here, so use yyyyMMdd instead.

An example using formatDateTime:

@formatDateTime(utcnow(), 'yyyyMMdd')

Upvotes: 1

Related Questions