Default TImezone in the Dataflow

Vaibhav 105 Reputation points
2024-05-27T20:45:04.3433333+00:00

Hi Team,

Is there anyway to change the default timezone in the datafactory?

Currently, when I am creating a column(loadtime) with currentTimestamp() in derived column transformation in the dataflow, then I get the time in UTC. But, I want the default to be in CST.

I know that we can use conversion function to convert it to CST. However, checking if we can change the default timezone from UTC to CST.

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

2 answers

Sort by: Most helpful
  1. Amira Bedhiafi 33,071 Reputation points Volunteer Moderator
    2024-05-27T21:12:25.6033333+00:00

    You can use a Derived Column where you use addHours to adjust the timestamp to CST which is UTC-6 hours, so you would subtract 6 hours from the UTC timestamp.

    
    addHours(currentTimestamp(), -6)
    
    toTimestamp(addHours(currentTimestamp(), -6), 'yyyy-MM-dd HH:mm:ss')toTimestamp(addHours(currentTimestamp(), -6), 'yyyy-MM-dd HH:mm:ss')
    
    

    If you need to handle daylight saving time, you would need to implement conditional logic to adjust the offset based on the current date.

    
    iif(
    
    (month(currentTimestamp()) == 3 && day(currentTimestamp()) >= 8 && dayOfWeek(currentTimestamp()) == 1 && hour(currentTimestamp()) >= 2) ||
    
    (month(currentTimestamp()) == 11 && day(currentTimestamp()) < 8 && dayOfWeek(currentTimestamp()) == 1 && hour(currentTimestamp()) < 2),
    
    addHours(currentTimestamp(), -5),  // CDT
    
    addHours(currentTimestamp(), -6)   // CST
    
    )
    

  2. Smaran Thoomu 24,110 Reputation points Microsoft External Staff Moderator
    2024-05-30T07:39:20.6433333+00:00

    Hi @Vaibhav

    Thanks for the clarification.

    As of now, there is no way to change the default timezone in Azure Data Factory. However, you can use the fromUTC function to convert the UTC timestamp to CST.

    You can use the following expression in the Derived Column transformation to convert the timestamp to CST:

    toTimestamp(fromUTC(currentTimestamp(), 'Central Standard Time'), 'yyyy-MM-dd HH:mm:ss')
    

    This expression will convert the UTC timestamp to CST and handle the Daylight Saving Time automatically. Please note that you need to replace 'Central Standard Time' with the appropriate timezone name if you are not in the Central Time Zone.

    Hope this helps. Do let us know if you any further queries.


    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.

    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.