Expand my Community achievements bar.

SOLVED

Calculated Field- Data Prep Function - To Convert default UTC to EST

Avatar

Level 2

Hi Team,

Using Calculated Attribute feature, I am trying to Convert default UTC to EST time. Ho do we do it?
zone_date_to_zone(now(), 'America/New_York')   --> this is not working

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @gowtham3 

The zone_date_to_zone() function is suppose to change any date time from one time zone to another however if you check the description it says if the zone name is not valid it will return date time in UTC, In the official document for data prep functions there seems to be a mistake in the example as the function mentioned in example is incorrect check the screenshot below.

Ankit_Chaudhary_1-1717752893071.png


There is no example mention in the data prep calculated field editor for this function but it seems like you have to provide a specific date time for a particular zone to convert it into another time zone, the now() function will return date time in UTC time zone due to which zone_date_to_zone() is also returning the results in UTC i have tired it for Asia/Calcutta but getting incorrect results.

Ankit_Chaudhary_0-1717752503767.png

 

View solution in original post

6 Replies

Avatar

Community Advisor

@gowtham3 Could you add more details, what data type is the field you are trying to map? 

When string fields from incoming data are mapped to date fields in schemas using XDM, the date format should be explicitly mentioned. 

 

 

Avatar

Level 2

Hi Anil,

As mentioned below, we are trying to use a data prep function in calculated fields, which uses a system default now() method to generate the current date in UTC but trying to apply  zone_date_to_zone funtion to convert the UTC to ET time zone. Any help on what is the right zone format to send in-order to get the ET timestamp?
 zone_date_to_zone(now(), "America/New_York") 

Avatar

Correct answer by
Community Advisor

Hi @gowtham3 

The zone_date_to_zone() function is suppose to change any date time from one time zone to another however if you check the description it says if the zone name is not valid it will return date time in UTC, In the official document for data prep functions there seems to be a mistake in the example as the function mentioned in example is incorrect check the screenshot below.

Ankit_Chaudhary_1-1717752893071.png


There is no example mention in the data prep calculated field editor for this function but it seems like you have to provide a specific date time for a particular zone to convert it into another time zone, the now() function will return date time in UTC time zone due to which zone_date_to_zone() is also returning the results in UTC i have tired it for Asia/Calcutta but getting incorrect results.

Ankit_Chaudhary_0-1717752503767.png

 

Avatar

Level 2

Yes, the standard way to convert to a particular time zone is not working as expected!   In my case, I am using  "America/New_York"  --> this is generating UTC time only. Not sure what is the correct zone string to convert to ET time zone.

Avatar

Level 2

Hey Gowtham, were you able to solve this issue, If yes, Please share.

Avatar

Level 2

not yet, no solution  yet for this. Will keep this thread posted once we solved it.