Converting Local Dates to UTC

Hello,

I’m building a query that uses datetimes (dd/mm/yyyy hh:mm:ss). Since the database stores all dates in UTC, I understand that I need to convert the input dates to UTC before using them in the query.

Could you please let me know which Codeless blocks or functions I should use to perform this conversion correctly?

Thank you in advance.

Regards,
Manuel

Hello @Manuel_Germano

Try the following:
Data4

Also, in addition to the timestamp, you can use the time formats presented here - Supported Date Formats.

Regards,
Volodymyr

Thank you @Volodymyr_Ialovyi

One more question, is it true that “convert to timestamp for date” already makes the bridge to UTC? Meaning, this function already transforms the date at stake to UTC format.

Thank you.

Regards,
Manuel

Yes, the convertToUTCStringForDate can be called the bridge to UTC.

If you’re curious about what a particular block does, you can see what JavaScript is behind it as follows:


Suppose you run the following code in Texas, where the local time zone is UTC−5 (Central Daylight Time in May):

(new Date()).toUTCString();

What happens step by step:

  1. new Date()
  • Creates a Date object representing the current local time.
  • For example, if your computer clock shows May 27, 2025, 10:00:00 AM (Texas local time, UTC−5), then new Date() captures that local time.
  1. .toUTCString()
  • This method now “builds a bridge” from the local time zone to UTC — it takes the internal UTC time and returns a string formatted in the UTC standard (specifically in GMT-style).
  • The output would be:
"Tue, 27 May 2025 15:00:00 GMT"

Summary:
The toUTCString() method:

  • Does not change the date/time — it just formats it into a string using UTC/GMT.
  • Serves as a “bridge” from local time to UTC, letting you see how the current moment is represented globally.

Regards,
Volodymyr

Hello @Volodymyr_Ialovyi ,

Thank you for your reply, but my last question was about the function “convert to timestamp for date”. It seems that this automatically converts the provided date to UTCdate.

This timestamp corresponds to the following date:

Thank you again.

Regards,
Manuel

Hi @Manuel_Germano

I just tried the timestamp you provided and what it look like in my zone and UTC