Skip to main content
Convert to Local Date

The movedata__ConvertToLocalDateFlowComponent converts a datetime into a local date, informed by timezone.

James Kent avatar
Written by James Kent
Updated over 3 months ago

Description

This component take a datetime input and converts it into a date using a timezone. Some platforms will set a datetime using the hosting server's timezone, others will use the browser's timezone and those using best practices will format using UTC.

Parameters

Input

  • DateTime Input (DateTime): The datetime to be transformed into a date value.

  • Timezone (String): The timezone to be applied to the inputted datetime. Expected to be from this list of timezones in IANA timezone format. If omitted, then the component will use the MoveData user's timezone.

Output

  • Local Date Output (Date): The date of the inputted datetime converted to the provided timezone.

  • UTC Date Output (Date): The date of the inputted datetime converted UTC (which is GMT +0).

Examples

One of the decisions that needs to be made is around which date output you should be using. This primarily comes down to whether the date time used as an input is in a specific timezone or is in UTC.

Often, you can expect a formatted datetime with zero'd out time (such as 2024-04-20T00:00:00.000Z) is a datetime representation of a date where the time is irrelevant. In this case, you will want to use the UTC Date Output value as the time is already in UTC, it will return the date of 2024-04-20. If you were to pass the timezone America/New_York (which has a standard timezone offset of -5), the component would have returned a Local Time Output of 19-04-2024 as it would have subtracted 5 hours from midnight on the 20th April 2024.

If the above scenario doesn't fit your scenario, you may be getting a datetime formatted using a timezone other than GMT+0. Try using the Local Date Output without a timezone provided (which will default to using the MoveData's user timezone).

Platform Specific Scenarios

Raisely

  • Raisely will record date values such as Date of Birth as datetime, using the browser's timezone. If a donation is made from a computer in Egypt, then this is the timezone that is applied to the datetime values. Raisely does not provide the browser's timezone. To compensate for this as best as possible, MoveData looks up the browser's IP address which is provided to infer the timezone (which is ~99% accurate). The timezone is provided as a custom value named ipAddressTimezone. For these values, pass the ipAddressTimezone as the timezone and use the Local Date Output.

Funraisin

  • Funraisin doesn't provide a timezone for its datetime values. These are not in UTC time and will often be the Australia/Sydney timezone as this is where the server is often hosted. However, this is not definitive to please try the following combinations. For these values, pass Australia/Sydney timezone or leave blank to use the MoveData user's timezone and use the Local Date Output.

Did this answer your question?