Homey Community Forum

Convert time from 24HRS to 12HRS

Hi All,

I’m planning to do a flow Google TTS to tell time in natural 12hrs speech.
Example speech “The time now is three pm” or “The time now twelve-oh-nine-am” for 0009HRS

I know time convert from 24 hours to 12 hours can be done using mathJS by extracting hour and mins from time tag such as $#HH$ -12 and $#mm# then concatenate am/pm and combining a lot of flows … etc.

Not sure if homey have a more simplified method or app to do conversion ? :thinking:

Dit you test it? My google-home mini says " it is 2 o clock in the afternoon" , but than in Dutch.

if ask google-home mini, “Hey google what is the time now?”, it will respond to me “It’s eight oh nine pm”, which is perfect.

But my intention is to make use of Homey to do Google TTS such as below flow example:
Screenshot1

the google-mini will respond in military time as “The time is twenty oh-nine”

Hence is there any easier method to make the time tag not in military time ? :thinking:

Seems you are using TTS on the Google Services app, and not Google TTS app, don’t know if that has a different behaviour. I’m using the Google-TTS app and just let it say the (tag) time.

With the Google Services App you can use SSML, and you can use coding to get the speech you want.
See the topic for the ssml examples.

1 Like

Hey Arie thanks you for your advise :clap:
Yes, the SSML indeed provided solution for time conversion from 24HR to 12HR easily for English.

Here the example in case someone can use for references flow pic:
Capture

I also tried another language such Japanese, but strangely it seems not working, :face_with_raised_eyebrow: will need to check with google support.