Help talk:Time function

Page contents not supported in other languages.
Source: Wikipedia, the free encyclopedia.

Language code

[1] Two-letter

ISO 639-1 codes
only allowed - try it (639-1 / 639-3):

  • {{#timel: xg | | hr}} → svibnja
  • {{#timel: xg | | hrv}} → May
  • {{#timel: xg | | de}} → Mai
  • {{#timel: xg | | ger}} → May
  • {{#timel: xg | | pl}} → maja
  • {{#timel: xg | | pol}} → May

--Bonč (talk) 23:52, 26 April 2016 (UTC)[reply]

What about BCE dates?

What about BCE dates?

This is an encyclopedia. Encyclopedias include BCE dates in articles on history, religions and biography.

So the sorting and formatting of BCE dates are important functions to consider in Wikipedia. Which makes their absence from the discussion conspicuous.

For example here: https://en.wikipedia.org/w/index.php?title=Talk:List_of_monarchs_who_abdicated&action=edit&section=2

  1. They didn't sort the date column because the historians who care of the page don't know how.
  2. Also they used BC instead of BCE.

This provides some clues as to what to do: https://en.wikipedia.org/wiki/ISO_8601#Years

Years
YYYY
±YYYYY
ISO 8601 prescribes, as a minimum, a four-digit year [YYYY] to avoid the year 2000 problem. It therefore represents :years from 0000 to 9999, year 0000 being equal to 1 BC and all others AD. However, years prior to 1583 are not automatically allowed by the standard. Instead "values in the range [0000] through [1582] shall only be used by mutual agreement of the partners in information interchange."[10]
To represent years before 0000 or after 9999, the standard also permits the expansion of the year representation but only by prior agreement between the sender and the receiver.[11] An expanded year representation [±YYYYY] must have an agreed-upon number of extra year digits beyond the four-digit minimum, and it must be prefixed with a + or − sign[12] instead of the more common AD/BC (or CE/BCE) notation; by convention 1 BC is labelled +0000, 2 BC is labeled −0001, and so on.[13]

So:

  1. There needs to be prior agreement.
  2. There needs to be a function to display March 15, 44 BCE when given -0044-03-15 (or -00440315) as input.
  3. This should be done so that both
a. columns are sortable
b. dates are readable by historians, grade 6 students, and other laypeople.

(I've also posted this in "Wikipedia talk:Manual of Style/Dates and numbers/Date autoformatting", because what they say should correspond with what is made available here.) 50.71.169.56 (talk) 19:45, 6 August 2017 (UTC)[reply]

The {{
Dts
}} template creates a hidden sort key, which allows dates to be sorted in chronological order. As an example, the year 204 BC sorts in the same order as if it were -204. I haven't tested what would happen if you said the year was 0. The appearance of the date in the table can be selected from several formats.
What the Dts template does not allow for is Julian vs Gregorian calendar. So people creating a table would have to do one of three things:
  1. Express all the dates in the Julian calendar.
  2. Express all the dates in the Gregorian calendar;
  3. Make sure none of the Julian or Gregorian dates are close enough that the order would come out wrong.
The lack of support for the Julian calendar also means the year functions described on this page are not reliable for computing the time between two dates if either or both of the dates are Julian.
As for BC vs BCE, see
WP:ERA
.
As for the idea that ISO 8601 requires agreement among the communication partners to use dates before 1583, this is why Wikipedia does not use the YYYY-MM-DD format for dates before 1583. We also don't use the YYYY-MM-DD format for Julian calendar dates. These formats could (but don't need to be) used with the Dts template, as long as their changed to a different format for display to the reader if they are Julian or before 1583. Jc3s5h (talk) 20:56, 6 August 2017 (UTC)[reply]

now - 1 month on the 31st of July

One feature of the function doesn't work properly : the now - 1 month seems to substract 30 days to the 31st of July instead of a month. For example, today the 31st of July :

{{#time: j F Y|31 July 2018}} gives 31 July 2018

{{#time: j F Y|31 July 2018 -1 month}} gives 1 July 2018

Is there a way to solve this problem ? --Ptitmouk (talk) 12:25, 31 July 2018 (UTC)[reply]

Similar, there is a bug in time zones (documented here):
{{#timel: H:i | -4.5 hours }} isn't correct → 23:47 -4.5 hrs ≠ 08:47
{{#timel: H:i | -270 min }} → 19:17 or {{#timel: H:i | -16200 sec }} → 19:17, because 23:47 - 4,5 hours = 19:17.
That is, you cold write
{{#time: j F Y|31 July 2018 -31 day}} 30 June 2018
And yes, there is equivalent local form #timel not mentioned on Help page, but you can see it's action in corresponding page in Croatian (far right column in table).  • Bonč (talk) • All hope abandon, ye who enter messages here. •  02:08, 4 February 2020 (UTC)[reply]

2038 proof?

Is {{#time: U}} Year 2038 problem-proof? (Please ping me on reply, thanks) Deryck C. 21:50, 30 July 2019 (UTC)[reply]

@Deryck Chan: Yes. Trying it out...
  • 2037-01-01 --> 2114380800
  • 2038-01-01 --> 2145916800
  • 2039-01-01 --> 2177452800
-- John of Reading (talk) 05:36, 31 July 2019 (UTC)[reply]
Thank you John of Reading! I'm building a gallery system that uses {{#expr: floor({{#time:U}}/86400) mod {{PAGESINCATEGORY:Some_category}} + 1}} to change the exhibit once a day. Given that some features of Wikipedia have been untouched since the early 2000s, it makes sense to check that everything we build now is 2038-proof! Deryck C. 10:17, 31 July 2019 (UTC)[reply]

Saka calender

Hi all, I would like to add

talk) 04:43, 3 August 2021 (UTC)[reply
]