How to Generate and Manipulate UTC Timestamp in "yyyy-MM-ddTHH:mm:ss.SSS" Format in Azure Data Factory Dataflow

Ananya patil 40 Reputation points
2025-04-10T04:29:44.58+00:00

I’m trying to generate the current UTC timestamp in the format yyyy-MM-ddTHH:mm:ss.SSS and also add/subtract time in Azure Data Factory Dataflow.

I’m using formatDateTime(utcnow(), 'yyyy-MM-ddTHH:mm:ss.SSS') to get the timestamp, and for time manipulation, I’ve tried dateAdd(utcnow(), 5, 'Minute') to add 5 minutes and dateAdd(utcnow(), -5, 'Minute') to subtract 5 minutes.

However, I’m unsure how to combine both the format and the time manipulation correctly. Any advice?

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

1 answer

Sort by: Most helpful
  1. Ganesh Gurram 6,040 Reputation points Microsoft External Staff
    2025-04-10T05:20:10.8966667+00:00

    @Ananya patil

    To generate a UTC timestamp in the format of yyyy-MM-dd'T'HH:mm:ss.SSS, you can use either of the following expression that might give you the desired output format with the T separator.

    concat(
        toString(toUTC(currentTimestamp(), 'yyyy-MM-dd')),
        'T',
        toString(toUTC(currentTimestamp(), 'HH:mm:ss.SSS'))
    )
    

    Adding and Subtracting Time: For adding or subtracting time, you can still use the addToTime() and subtractFromTime() functions.

    Subtract 1 day:

    concat(
        toString(toUTC(subtractFromTime(currentTimestamp(), 1, 'Day'), 'yyyy-MM-dd')),
        'T',
        toString(toUTC(subtractFromTime(currentTimestamp(), 1, 'Day'), 'HH:mm:ss.SSS'))
    )
    

    Add 1 hour:

    concat(
        toString(toUTC(addToTime(currentTimestamp(), 1, 'Hour'), 'yyyy-MM-dd')),
        'T',
        toString(toUTC(addToTime(currentTimestamp(), 1, 'Hour'), 'HH:mm:ss.SSS'))
    )
    

    These expressions should help you achieve the desired format with the T character included.

    I hope this information helps.


    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.


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.