How to debug: error when inputting timestamp data (from api) into a timestamp DB field (MySql8)

Hey all,

Can anyone please guide me how I can debug why I am getting errors when trying to input timestamp data from an API into a timestamp data field in my DB? Getting the following error:

ER_TRUNCATED_WRONG_VALUE: Incorrect datetime value: '1524773620' for column 'billing_period_ends_at

I’ve tried:

  • changing the DB field to datetime, time, date - no luck
  • tried changing the $_POST value to date, time, text
  • tried using a setValue to change the value to various outputs such as timestamp, datetime etc.

Whatever I do, I get the same error above - I’m sure it’s me! So if anyone can help guide debugging this I’d be grateful!

Haven’t encountered this error before. A quick Google returns this:

Maybe use a custom query to insert instead of insert query step?

MySQL timestamp field just expects a different date format which is YYYY-MM-DD HH:MM:SS so you need to convert your Unix timestamp value to this format.

https://dev.mysql.com/doc/refman/8.0/en/datetime.html

1 Like

Thank you both, I did try converting the datetime - but i’ll follow the above and see if I can get it working :slight_smile:

I just tested the data conversion and it works fine:

{{timestamp_test.formatDate('yyyy-MM-dd HH:mm:ss')}}

Screenshot_32

3 Likes

Thank you @Teodor - I will try this!

Just confirming this worked great, thank you Teodor.

1 Like