Open Menu
AllLocalCommunitiesAbout
lotide
AllLocalCommunitiesAbout
Login

Wish there was a toggle for it like there is on phones

⁨284⁩ ⁨likes⁩

Submitted ⁨⁨4⁩ ⁨months⁩ ago⁩ by ⁨renzev@lemmy.world⁩ to ⁨[deleted]⁩

https://lemmy.world/pictrs/image/4b5b9045-4877-4a9c-9f2d-45c7755780b3.png

source

Comments

Sort:hotnewtop
  • IDKWhatUsernametoPutHereLolol@lemmy.dbzer0.com ⁨4⁩ ⁨months⁩ ago
    If
    "am/pm indicator" = "pm"
    AND
    "hour" =/= "12"
    ADD "12" to "hour"
    
    Else
    Ignore the am/pm indicator, time is correct in 24 hour format.
    

    Disclaimer: I am not a programmer, I have no idea if my “code” is written in the correct format.

    source
    • Zagorath@aussie.zone ⁨4⁩ ⁨months⁩ ago

      As far as pseudocode goes, this is pretty damn good. The main thing I’d change is that things in “quotes” generally represent strings, i.e. literal text. Variable names usually don’t have quotes around them. That’s a universal enough trait of real programming languages that it would almost never not transfer to pseudocode. Also, numbers intended to be read as numbers don’t typically have quotes.

      How I would change this accordingly

      If am_pm_indicator = “pm” AND hour =/= 12 ADD 12 to hour Else Ignore the am/pm indicator, time is correct in 24 hour format. # Leaving this as-is because it’s more like a comment than code anyway

      source
    • bandwidthcrisis@lemmy.world ⁨4⁩ ⁨months⁩ ago

      What is this? Some sort of COBOL or something.

      source
      • IDKWhatUsernametoPutHereLolol@lemmy.dbzer0.com ⁨4⁩ ⁨months⁩ ago

        Idk its my non-programmer’s impression of what code lools like, sorry if its incorrect 😅

        source
        • -> View More Comments
    • LwL@lemmy.world ⁨4⁩ ⁨months⁩ ago

      If only this was true, but for some reason midnight is 12 am. And noon is 12 pm (I’m aware that the reason is that 12:00:00.00001 is in the second half of the day. I just think it should be called 0 pm).

      source
      • sxan@midwest.social ⁨4⁩ ⁨months⁩ ago

        Midnight is 00:00 is 12am. They accounted for 12pm, but need to subtract 12 if it’s 12am.

        So, you’d do away with 12 entirely and make AM/PM 0-based: 00:00am - 11:59am, and then 00:00pm - 11:59pm? Makes sense if you’re a programmer, but 0 is a fairly recent invention, and most daily measuring concepts are fundamentally 1-based. Heck, we couldn’t even get all programming languages to agree on 0-based array indexing (looking at you, MATLAB, and you, bash).

        source
  • Kolanaki@yiffit.net ⁨4⁩ ⁨months⁩ ago

    You don’t even need to convert anything if they meant 5am.

    source
    • Aurenkin@sh.itjust.works ⁨4⁩ ⁨months⁩ ago

      Why’d you have to say 5AM instead of just 5? Now I need to convert it to 24h time

      source
    • synae@lemmy.sdf.org ⁨4⁩ ⁨months⁩ ago

      Yea, you just disown them as a friend and easily away

      A real friend would never make you do something that early

      source
  • NegativeLookBehind@lemmy.world ⁨4⁩ ⁨months⁩ ago

    5+12

    Or

    17-2, drop the 1

    source
    • renzev@lemmy.world ⁨4⁩ ⁨months⁩ ago

      yeah, adding twelve to a single-digit number really does make my brain freeze like that. Something something can’t do math under pressure.

      source
      • NegativeLookBehind@lemmy.world ⁨4⁩ ⁨months⁩ ago

        That’s OK, champ.

        source
      • JustAnotherKay@lemmy.world ⁨4⁩ ⁨months⁩ ago

        This might help you: you’re not adding 12 to a single-digit number. Just do 2 + x then throw a 1 in front, or add 10. Whichever is easier to conceptualize. (Where x is the single-digit number, in case that needed clarifying)

        source
    • sleen@lemmy.zip ⁨4⁩ ⁨months⁩ ago

      (5+2) + 10

      source
  • RememberTheApollo_@lemmy.world ⁨4⁩ ⁨months⁩ ago

    After a while there is no conversion necessary. 5 pm is 5 pm is 17:00. They are the same. UTC to local however can get fucked. Time zone variables, daylight standard/savings variables, no thanks.

    source
    • sxan@midwest.social ⁨4⁩ ⁨months⁩ ago

      Yeah, I never found adding 12 to or from a number to be particularly challenging. Still, I do wish AM/PM would go away, not to mention DST. Can’t escape UTC and time zones, though, not reasonably, anyway. If for no other reason than doing the conversion makes you aware of how inconvenient your suggested meeting time is for the other party.

      source