Template talk:Utc

From Wikipedia, the free encyclopedia

Contents

[edit] Current time

Simple versions
  • Los Angeles: 00:12
  • Denver: 01:12
  • Chicago: 02:12
  • New York: 03:12
Production versions

[edit] Fractional time zones

Try this: {{hour12|{{mod 24|{{add2|{{current hour}}|{{{1}}}}}}}}}:{{mod 60|{{add2|{{current minute}}|{{{2}}}}}}} {{AMPM|{{mod 24|{{add2|{{current hour}}|{{{1}}}}}}}}} TimBentley 04:49, 25 March 2006 (UTC)

I just updated it, but I can't check it now (I checked some, which work), so feel free to revert if it messed stuff up. TimBentley 18:01, 25 March 2006 (UTC)
It screwed up when the minutes were zero, I'll fix it later. TimBentley 18:03, 25 March 2006 (UTC)
I changed Template:mod 60; this should work now. TimBentley 21:43, 25 March 2006 (UTC)

[edit] Why 12 hour clock?

Why does this template use a 12-hour clock instead of the standard 24-hour clock of UTC, ISO 8601 and {{CURRENTTIME}}? That would be easier and more consistent. Kusma (討論) 01:40, 30 March 2006 (UTC)

Probably because an American made it. I'll look into changing it. TimBentley (talk) 14:58, 30 March 2006 (UTC)

[edit] Two-digit minute

We need to find a way to make EXPR return a two-digit minute. Times like 10:8 just confuse me. It should be 10:08 right?

I created {{two digit}} to fix this. Please wait till 15:00 (UTC) and then test it. --Uncle Ed 14:17, 14 April 2006 (UTC)

I got 6:32 from it, using the subst: prefix with {{utc}} just now. I guess it's okay, then. --Uncle Ed 16:03, 14 April 2006 (UTC)

Looks awesome Ed. Pcb21 Pete 10:45, 16 April 2006 (UTC)

[edit] Mod 24 buggy for negative numbers, plus workaround

The following expression {{#expr: -5 mod 24}} should equal 19 but at the time of writing actually equals -5. (If that says 19 rather than -5 by the time you're reading this I am going to look silly but it did honest!). This is problematic for occasions where UTC is say 6am and you want the time in Los Angeles to read 23:00 by doing {{utc|-7}}. To avoid having to do ugly workarounds like writing 17 rather -7 as the template argument, I am going to add 24 to the current hour in this template. Pcb21 Pete 10:45, 16 April 2006 (UTC)

The patch has now been applied and works. Pcb21 Pete 10:56, 16 April 2006 (UTC)
You sure? AFAIK: -5 mod 24 is -5. See Modulo operation. —Locke Cole • tc 10:55, 16 April 2006 (UTC)
Well if there are two different conventions (and I certainly grew up with the way I mentioned), then the +24 will have to be permanent. I don't think readers will take too kindly to 9pm being written as -3! Pcb21 Pete 10:58, 16 April 2006 (UTC)
Actually the article you cite agrees with me. Both you and the current implementation are mistaken, I'm afraid. Pcb21 Pete
No.. Windows Calculator (using the Scientific view; the Standard view doesn't have a "MOD") returns -5, and a brief console app written in Pascal consisting of the following:
{$APPTYPE CONSOLE}
program modtest;

begin
  WriteLn(-5 mod 24);
end.
Also says -5 on output. The implementation here is correct, however you seem to have fixed it with the +24. =) So no worries if it works, right? —Locke Cole • tc 11:46, 16 April 2006 (UTC)
Indeed no worries at all, this template is now quite usable IMO. Interesting though. What mathematicians do (see Modular arithmetic) is not the same as what computers do as you rightly corrected me. I'll know that for next time. Pcb21 Pete 12:10, 16 April 2006 (UTC)


[edit] Using this template on "many pages"

One reason why it is awkward to use this template on many pages is that you have to change every page individually when there is a daylight savings change. I have devised a template that calls this one, but minimizes the number of pages that need to be changed when there is a daylight savings change (e.g. Western Europe all change their clocks on the same day, so we only need to change one page to keep western European pages up-to-date. Please check out {{CurrentTimeIn}} (or {{CurrentTimeInHeader}} for a template that takes care of positioning too) and give me feedback. Pcb21 Pete 10:56, 16 April 2006 (UTC)

[edit] Blink

I removed the blink formatting, it affected:

"{{before|3|26|time is {{utc|-5}} in ny|time is {{utc|-4}} in ny}}" → "time is 03:12 in ny"; should say "time is 03:12 in ny".

Patrick 12:25, 16 May 2006 (UTC)