03-24-2020 07:34 AM
hi
i have Seconds To Date/Time Function and i separated it to hour,min,sec by unbundle by name function as the picture. i don't know how to separate AM PM.is it possible to separate them? if not, is there any other way?
thank you
Solved! Go to Solution.
03-24-2020 07:59 AM - edited 03-24-2020 08:01 AM
On my computer, I get a 24H time for "Hour".
If you get the same, then you can do Quotient and Remainder with 12 as the divisor.
If quotient is 1, then it's PM, otherwise, it's AM.
The remainder is the hours in AM/PM style.
Note also that you don't have to connect the "Get Date/Time in Seconds" function if you want the time "now" - that's the default value.
You only need to wire that input for a time that is "not now", as it were...
03-24-2020 08:01 AM
03-24-2020 08:04 AM - edited 03-24-2020 08:06 AM
I was going to test that out, and then I saw you did something naughty...
As an aside, "%<%I %p>T" (that's a capital "i") will get you the 12-hour time value for hours followed by "AM" or "PM".
03-24-2020 08:15 AM
03-24-2020 08:20 AM
Caveat: I don't know if/how it'll work if you have 24h setting ...
/Y
03-24-2020 12:21 PM
@Yamaeda wrote:
Caveat: I don't know if/how it'll work if you have 24h setting ...
/Y
Not sure what you mean. A timestamp has no such setting (it is always simply the number of seconds since jan 1, 1904 GMT) no matter what.
However if you add a %H in the same timestamp format container before a %p, it is indeed ignored.
In addition, the %p format code does not seem to work if your system doesn't use a system time format that uses AM/PM! That's an unpleasent surprise!
03-24-2020 11:06 PM
@rolfk wrote:
@Yamaeda wrote:
Caveat: I don't know if/how it'll work if you have 24h setting ...
/Y
Not sure what you mean. A timestamp has no such setting (it is always simply the number of seconds since jan 1, 1904 GMT) no matter what.
However if you add a %H in the same timestamp format container before a %p, it is indeed ignored.
In addition, the %p format code does not seem to work if your system doesn't use a system time format that uses AM/PM! That's an unpleasent surprise!
Hmm. Worked for me last night on my computer at home and today also works.
Both PCs are running Windows 10 with a 24H system clock.
Here's my current result with a few format specifiers. As you mentioned, the %H seems to block the %p, but I don't really know why you'd want them both (as shown in the second string here):
03-25-2020 03:09 AM
@rolfk wrote:
In addition, the %p format code does not seem to work if your system doesn't use a system time format that uses AM/PM! That's an unpleasent surprise!
That's what i meant. 🙂
So the code isn't error proof, you'd need to first do a Format into string in a AM/PM format to extract it or something ... Hmm, some quick tests exposed a bug, i'll post in the relevant forum, though can someone test if 2019 or earlier reacts to Time stamp control properties 'Custom format' and change AM/PM <-> 24h setting?
So, the safe version is probably the previously posted Date-rec and quotient calc, as that one is always 24h.
/Y
03-25-2020 03:13 AM
@cbutcher wrote:
Hmm. Worked for me last night on my computer at home and today also works.
Both PCs are running Windows 10 with a 24H system clock.
Here's my current result with a few format specifiers. As you mentioned, the %H seems to block the %p, but I don't really know why you'd want them both (as shown in the second string here):
Interesting.
I get this with 24h: