Skip to main content
Solved

DATETIME_FORMAT and SET_TIMEZONE for NOW()


Forum|alt.badge.img+16

Hi, I'm feeling a little stupid in this moment, because I know that I'm doing a little mistake🤣 but I can't find it!

I need to print the actual hour, so if now it is 10:31 am, I need that the result is 10. I'm trying to use DATETIME_FORMAT and SET_TIMEZONE.. but it gives me error.

 

do you know how can I solve this problem?

 

Best answer by NicoB

Hmmmm i guess that depend on your account time zone

To avoid the issue, try this :
DATETIME_FORMAT(SET_TIMEZONE(NOW(), 'America/New_York'), 'H')

 

View original
Did this topic help you find an answer to your question?

4 replies

Forum|alt.badge.img+5
  • Inspiring
  • 8 replies
  • October 2, 2023

Here's how you can format the current time to display just the hour in Airtable:

DATETIME_FORMAT(NOW(), 'h')

This formula will return the current hour in a 12-hour clock format. If you want it in a 24-hour clock format, you can use 'H' instead of 'h':

DATETIME_FORMAT(NOW(), 'H')

 


Forum|alt.badge.img+16
  • Author
  • Inspiring
  • 89 replies
  • October 2, 2023
NicoB wrote:

Here's how you can format the current time to display just the hour in Airtable:

DATETIME_FORMAT(NOW(), 'h')

This formula will return the current hour in a 12-hour clock format. If you want it in a 24-hour clock format, you can use 'H' instead of 'h':

DATETIME_FORMAT(NOW(), 'H')

 


Hi, thank you for your help, I tried this, but it gave me the wrong time.. but at the moment is 10:50 am

 

For this reason, I thought about set a time zone

 


Forum|alt.badge.img+5
  • Inspiring
  • 8 replies
  • Answer
  • October 2, 2023

Hmmmm i guess that depend on your account time zone

To avoid the issue, try this :
DATETIME_FORMAT(SET_TIMEZONE(NOW(), 'America/New_York'), 'H')

 


Forum|alt.badge.img+16
  • Author
  • Inspiring
  • 89 replies
  • October 2, 2023
NicoB wrote:

Hmmmm i guess that depend on your account time zone

To avoid the issue, try this :
DATETIME_FORMAT(SET_TIMEZONE(NOW(), 'America/New_York'), 'H')

 


It works now! Thank you very much!


Reply