MagicETL Transform Settings: Timestamp to Date

I can't seem to find a clear answer as to what is happening here, so I'm turning to the community.

  • I have a dataset with a timestamp field, createdAt
  • The dataset arrives to Domo in UTC, and my company timezone settings are converting it to USA\Eastern Time. This is working as expected.
  • Using this as an input dataset in MagicETL, I get the same expected timestamps.

The fun begins, however, when I change the field to Date on the input step (Input Dataset tile > Configuration > Data Handling > Column Type

Despite the timezone settings configured to inherit, I now get a date of 2024-11-12, rather than the 2024-11-11 it should be (see first screenshot). No matter what timezone I pick, I always get 2024-11-12.

What on earth is going on here?

Tagged:

Best Answers

  • rco
    rco Domo Employee
    edited November 12 Answer ✓

    When you set the type to "Date" in the Input DataSet's Data Handling section and the source data is CSV (as it is in many cases), it's not converting a timestamp to a date. It's converting a string to a date; the string is the text in the CSV field. The String to Date conversion discards all time and zone information, preserving only the year, month, and day from the string. The timezone setting has no effect on string to date conversion; it has no effect on any operation that does not involve timestamps.

    You've said the timestamps in question are written to Domo as UTC, which means the timestamp 2024-11-11T22:37:38-05:00 is represented in the CSV file as the string 2024-11-12T03:37:38 or something similar. The date in the string will be 2024-11-12.

    The Data Handling section is best used when you suspect the type that Domo selected for the column is incorrect. In this example, timestamp is the correct type, so it should be left as timestamp. Converting the timestamp to a date in a downstream tile will behave as expected; timestamp to date conversion does respect the timezone setting.

    Randall Oveson <randall.oveson@domo.com>

  • rco
    rco Domo Employee
    Answer ✓

    Unless it's a Cloud Amplifier DataSet, which I don't believe it is, then the connector is exporting the data from your DynamoDB. Most connectors export to CSV files. Those files are the form in which Magic ETL sees your data.

    Randall Oveson <randall.oveson@domo.com>

Answers

  • Have you run it through and looked at the completed output dataset? I have found the preview within Magic ETL to be misleading on date/times.

    **Check out my Domo Tips & Tricks Videos

    **Make sure to <3 any users posts that helped you.
    **Please mark as accepted the ones who solved your issue.
  • rco
    rco Domo Employee
    edited November 12 Answer ✓

    When you set the type to "Date" in the Input DataSet's Data Handling section and the source data is CSV (as it is in many cases), it's not converting a timestamp to a date. It's converting a string to a date; the string is the text in the CSV field. The String to Date conversion discards all time and zone information, preserving only the year, month, and day from the string. The timezone setting has no effect on string to date conversion; it has no effect on any operation that does not involve timestamps.

    You've said the timestamps in question are written to Domo as UTC, which means the timestamp 2024-11-11T22:37:38-05:00 is represented in the CSV file as the string 2024-11-12T03:37:38 or something similar. The date in the string will be 2024-11-12.

    The Data Handling section is best used when you suspect the type that Domo selected for the column is incorrect. In this example, timestamp is the correct type, so it should be left as timestamp. Converting the timestamp to a date in a downstream tile will behave as expected; timestamp to date conversion does respect the timezone setting.

    Randall Oveson <randall.oveson@domo.com>

  • chapman
    chapman Member
    edited November 12

    Thanks @rco ! That maybe explains it; except this is a DynamoDB dataset where the field is stored as timestamp. But perhaps something is happening in the connector which is causing Domo to perform the string to date conversion as you mentioned?

    Here's the input dataset in question, it is definitely writing to Domo as a timestamp before it ever enters the ETL.

    Good to know RE: best practice on using the Data Handling section! I appreciate the insight.

  • @MarkSnodgrass That's a good call — I do think that was part of my problem last night. Thank you!

  • rco
    rco Domo Employee
    Answer ✓

    Unless it's a Cloud Amplifier DataSet, which I don't believe it is, then the connector is exporting the data from your DynamoDB. Most connectors export to CSV files. Those files are the form in which Magic ETL sees your data.

    Randall Oveson <randall.oveson@domo.com>

  • @rco that answers it — thank you very much!