Discuss Help:Datatype "Date"

From semantic-mediawiki.org

Standard date ? 2010-03-10T07:30:00Z

2010-03-10T07:30:00Z, I need to insert this format, it's poosible ?

Selecting pages by date

  • How do I select pages by giving the year of a property of type date? Tomaschwutz 19:50, 12 January 2012 (CET)
One way would be
{{#ask: [[The date::≥1/1/2009]] [[The date::≤31/12/3009]]}}
--Jan "Saruman!" S. 21:24, 12 January 2012 (CET)

Handling of incomplete dates

The help page says that if only the year is entered, defaults will be used (and no error should occur). I am finding that when a semantic property tag of type date is used in a Semantic form, and an incomplete date is entered in that field, no result is returned--it is requiring not only the year and month, but also the day or else no information will be displayed.

Here is my version information:

MediaWiki 1.18.0
PHP 5.2.17 (cgi-fcgi)
MySQL 5.1.56
Semantic Forms (Version 2.3.2)
Semantic MediaWiki (Version 1.7)

Here is the relevant wikicode from the infobox template:

{{#if: {{{birthdate|}}}|! Birthdate {{!}} [[Birthdate::{{{birthdate|}}}]]}}

Here is the relevant wikicode from the form:

! Birth date: | {{{field|birthdate}}}

Here is the wikicode from Property:Birthdate

This property is a [[has type::date]] representing the birth date of a user.

What I would like to have happen is that if a user enters only a year in the form, then that year shows up in the infobox. If a month and year are entered, then the infobox displays that, and so on. Is there something I need to change to allow this?

Thanks in advance.--Lost Student 03:57, 26 January 2012 (CET)

Selecting pages by anniversary

How do I select pages by giving the day and month of a property of type date? I have pages with a property "birthday" or "foundation day", I want to select them by anniversary and if possible give their age in years. --Wouter Rademaker 13:48, 7 April 2012 (CEST)


Thread titleRepliesLast modified
Dates without years211:54, 26 January 2016
How to change date format in property page?114:51, 3 January 2016
SMW displaying dates in UTC016:40, 20 June 2014
Request - new date formats220:57, 6 May 2014
How can I sort a table for current's date is displayed?006:15, 26 March 2014
Enabling multinational date formats123:11, 1 February 2013

Dates without years

Not sure if this is true by design but there's no error message if a value of type 'Date' consists of just a day and a month, for instance "2 February" - a query for "2 February" gives appropriate results. Because such incomplete dates cannot be interpreted as points in time, as the page points out, I was surprised to see this behaviour, but if it is a bug, I'd welcome it anyway: it lets you add annual events without any specific start and end.

(Note also that if you had events on, say, 2 February 1567, 2 February 1785 and 2 February 2014, there's no way of querying for all events that happened on 2 February in whatever year; but adding "2 February" as a value would do the trick).

Cavila (talk)17:59, 25 January 2016

> type 'Date' consists of just a day and a month, for instance "2 February" - a query for "2 February"

Well, it is conceivable that a user would interpret "2 February" as something like 2nd of Feb with NO YEAR but the system understands the input as 0002 Year + 2nd Month hence the point in time is fixed by (Calendar model 2 (JL)/2 (Year) / 2(Month)) without a specific day or time.

From that perspective, Year + Month are allowed to exists without having to specify a day or time.

mwjames (talk)10:22, 26 January 2016

Oh I see, that makes sense and it explains why the date is listed as "February 2" in Special:Browse, if I recall correctly, and why "33 February" is permitted as well.

Cavila (talk)11:54, 26 January 2016

How to change date format in property page?

I would like to ask whether the date format in the property page could be changed. For example, in the property page of a DateType property, pages using this property in the list are automatically arranged by date. But the date displayed is always in the day-month-year format (e.g. 30 December 2013 23:59:25). I would like to know how to change it into year-month-day format. I have tried to search for solutions in this wiki but it seems that there is no related content.

JoesSR (talk)10:48, 6 February 2014

You can work with the parser function time. In your case this should work: {{#time:Y-m-d|{{{NameOfYourProperty|}}}}}

Stefan Seidner (talk)14:51, 3 January 2016

SMW displaying dates in UTC

Hello there,

SMW is displaying dates in Creation date and Modification date properties in UTC while wiki itself displays dates in article history pages in my local time, which is annoying. My server clocl is also set up to my local time zone. Any ideas how to fix this problem?

Olkhazar (talk)16:40, 20 June 2014

Request - new date formats

Would it be possible to add to SMW two new date formats? That is: BP and b2k. They are widely used in geology and archaeology. The "BP" is acronym to "before present" and is counted in years before 1950 (f.e., year 1900 = 50BP). The "b2k" means "years before year 2000", and is counted analogically: calendar year 1900 = 100b2k.

Of course it is possible to calculate dates from BC notation, but it makes some mess, because the BP and b2k notations are standard in earth sciences.

Thanks in advance,

DBobak (talk)19:55, 6 May 2014

Feature requests should be made at [0] in order to allow for appropriate tracking and analysis.

[0] https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues

mwjames (talk)20:36, 6 May 2014

Thank you for pointing this out!

all the best, Darek

DBobak (talk)20:57, 6 May 2014

How can I sort a table for current's date is displayed?

I tried putting this:

Juan Cristobal Viscarra (talk)06:11, 26 March 2014

Enabling multinational date formats

Hi there,

I am looking for a way to enable multiple date formats at once, like e.g. english and german formats. Currently, I can only choose one by setting wgLanguageCode. Do you see a way? Where are the actual definitions stored?

Kind regards and thanks

Argi (talk)18:05, 1 February 2013

You can control the output by using the PaserFunctions extension (#time), e.g. [[Has birthdate::{{{birthdate|}}}|{{#time:F j, Y|{{{birthdate}}}}}]] for the English format and [[Hat Geburtsdatum::{{{Geburtsdatum|}}}|{{#time:j. F Y|{{{Geburtsdatum}}}}}]] for the German format.

[[kgh]] (talk)23:10, 1 February 2013