LB Booster
Programming >> BASIC code examples >> Converting 24 hour clock to 12 hour
http://lbb.conforums.com/index.cgi?board=code&action=display&num=1501858918

Converting 24 hour clock to 12 hour
Post by Richard Russell on Aug 4th, 2017, 3:01pm

Over at the Liberty BASIC Community Forum they're getting their knickers in a twist over converting 24 to 12 hour clock. It's actually straightforward:

Code:
    for h24 = 0 to 23
        h12 = ((h24 + 11) mod 12) + 1
        if h24 < 12 then ampm$ = "AM" else ampm$ = "PM"
        print h24, h12, ampm$
    next 

Richard.

Re: Converting 24 hour clock to 12 hour
Post by michael on Aug 6th, 2017, 9:42pm

What a coincidence! I just posted a similar topic on the BBC forum. LOL


I tried to run the example on Liberty v4.5 but I cant get it to run on WINDOWS 10.. so I just used LBB.

*unable to allocate virtual address space

Update: I downloaded latest release and Liberty Basic will now function. (version 4.51 )