Support for 12hour Format #204
-
Hi, |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
This library internally only uses 24 hour time. The display of that time is left to the sketch writer. You need to convert it before displaying it. |
Beta Was this translation helpful? Give feedback.
-
If you can wait, I do plan to port some code I use in my own projects into the library for converting 24hour to 12 hour and back. |
Beta Was this translation helpful? Give feedback.
-
Thankyou Sir, I will try this and let you know.
Regards,
Bilal
…On Wed, Jan 24, 2024 at 5:13 AM Michael Miller ***@***.***> wrote:
Checked in.
To convert a 24 hour to 12 hour with am and pm, you do this...
RtcHourAmPm hourAmPm = dt.Hour();
or
RtcHourAmPm hourAmPm = dt.HourAmPm();
then the hourAmPm object contains accessors for hour in 12 hour format and
meridiem for am or pm.
Serial.print(hourAmPm.Hour());
if (hourAmPm.Meridiem() == Rtc_AM)
{
Serial.print("am");
}
else
{
Serial.print("pm");
}
—
Reply to this email directly, view it on GitHub
<#204 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BC7IUY6GXAN65Z4RHZKC6M3YQBDK5AVCNFSM6AAAAABCFUUQRWVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4DEMRWGU2TI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
Checked in.
To convert a 24 hour to 12 hour with am and pm, you do this...
then the hourAmPm object contains accessors for hour in 12 hour format and meridiem for am or pm.