How to get current date and time in retool during update query


I am updating the record, while updating under certain condition, I want to capture current date nad time. How can I do this. I am trying with various moment() function, but didn't get this.

1 Like

Hello @ishi8,

Have you tried the following?

Thanks for the code ugo.
Anyway to add to that to show me the same date - 365 days?

For example

02-01-2023
02-01-2022
02-01-2021

Im querying a weather api to show the current weather today as well as the weather for the same day on past years.

I tried something like this but didn't seem to get it to work

{{ var startdate = moment().subtract(365, "days").format("DD-MM-YYYY") }}

Cheers

@pete82 moment's subtract function is great for doing things like that!

You can try something like {{ moment().subtract(1, 'year').format('DD-MM-YYYY') }}

1 Like