Discuss Help:Datatype "Date"
Contents
Standard date ? 2010-03-10T07:30:00Z[edit]
2010-03-10T07:30:00Z, I need to insert this format, it's poosible ?
Selecting pages by date[edit]
- 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[edit]
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[edit]
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)
- [View source↑]
- [History↑]
Contents
Thread title | Replies | Last modified |
---|---|---|
sorting dates in tables | 1 | 01:44, 11 May 2019 |
Dates without years | 2 | 10:54, 26 January 2016 |
How to change date format in property page? | 1 | 13:51, 3 January 2016 |
SMW displaying dates in UTC | 0 | 15:40, 20 June 2014 |
Request - new date formats | 2 | 19:57, 6 May 2014 |
How can I sort a table for current's date is displayed? | 0 | 05:15, 26 March 2014 |
Enabling multinational date formats | 1 | 22:11, 1 February 2013 |
I don't quite get the example regarding sorting dates in a table. Who would want an extra table with the sortkey displayed?
{{#ask: [[Modification date::+]] |?Modification date |?Modification date#SORTKEY }}
I have seen SMW doing it wrong, but in sandbox everything works fine: https://sandbox.semantic-mediawiki.org/wiki/Date_sorting_in_tables
So why would I need #SORTKEY and how would I use it?
> I don't quite get the example regarding sorting dates in a table. Who would want an extra table with the sortkey displayed?
I don't know either but the function is available at least since 1.7.1 [0] and returns the JD of the date which is also used internally to sort dates.
> I have seen SMW doing it wrong
Where and in which context?
> So why would I need #SORTKEY and how would I use it?
[0] is the PR that introduced the output format and notes "new output format "sortkey" to help people who want to handcraft sortable tables containing date values".
Cheers
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).
> 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.
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.
You can work with the parser function time. In your case this should work: {{#time:Y-m-d|{{{NameOfYourProperty|}}}}}
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,
Feature requests should be made at [0] in order to allow for appropriate tracking and analysis.
[0] https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues
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
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.