Data factory can't parse zeroes at the end of a GMT timestamp after being converted from UTC

Mike Wong 46 Reputation points
2021-11-01T11:11:01.17+00:00

I am trying to dynamically read in files from a folder in data factory. The pipeline is as follows:

  • Set the date time using @convertFromUtc(utcnow(), 'GMT Standard Time') for the folder
  • Saves files into target folder
  • Iterate over folder using a ForEach loop with the condition of @activity('Get Folder Metadata').output.childItems, eventually setting the highest value to the folder variable
  • Dynamically use the folder variable in the following way: "folder/filename.txt"

Unfortunately, when this happens my folder name is 2021-10-31T22:00:07.7372910, however, Data Factory parses the folder name from the ForEach loop as 2021-10-31T22:00:07.737291Z which then reads it as incorrect when trying to read the file names.

I have tried:

  • Using substring to replace the last character with a 0.
  • Replacing Z with a 0. This doesn't work because, for some strange reason, ADF does not read the Z as a string character.
  • Using concat to add a '0' at the end of the timestamp.

So far, none of these have worked and it's very frustrating having a pipeline having a 10% chance to fail over ADF not being able to parse it's own dates. Is this because I am converting from UTC to GMT?

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,655 questions
{count} vote

1 answer

Sort by: Most helpful
  1. HimanshuSinha-msft 19,491 Reputation points Microsoft Employee Moderator
    2021-11-03T00:54:05.147+00:00

    Hello @Mike Wong ,
    Thanks for the ask and using Microsoft Q&A platform .
    I was able to repro the issue .Please use this and it should do the trick .

    @formatDateTime(item().name, 'yyyy-MM-ddTHH:mm:ss:fffffff')

    Please do let me know how it goes .
    Thanks
    Himanshu

    -------------------------------------------------------------------------------------------------------------------------

    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
    • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators
    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.