- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
03-30-2022 08:21 PM
Hi
We have date time coming in thru FIle import and would liek to convert it to Local time.
Issue: 1st Mar Local time becomes 28th Feb in GMT. Incorrect audience rule calculation.
Has anyone been able to convert or come sup with a solution where GMT time can be passed and it's converted to local time for audience valuation?
Thanks
Samrat
07-12-2022 04:02 PM
Hi Samrat,
This is possible with our release of data transformations, however, it does not currently work with the File Import data source. This is a request that is being considered by our product team.
In the meantime, you can set up a transformation for other data sources with the following code to add a "local_timestamp" variable to your data:
// "transform" function allows you to access event and apply changes transform((event) => { //const current_date = new Date(); //Instead of creating a new date, you can use the date being sent by the file import, shown below const current_date = event.data.udo.imported_date;
var _localOffset = 8*60*60*1000; //Replace the first number with your local offset (ex: Pacific Standard Time would show "8" because PST is 8 hours behind UTC) var local_timestamp = new Date(current_date.getTime() - _localOffset); event.data.udo.local_timestamp = local_timestamp.toISOString(); console.log("Local Time: " + JSON.stringify(event.data.udo.local_timestamp)); })
This code will add a new variable to your event titled "local_timestamp" which will show local time in the following string format:
"2022-07-12T15:48:29.990Z"
Please stay tuned to our Announcements Blog for more information on upcoming product features and releases.
Thanks,
Jen
Copyright All Rights Reserved © 2008-2023