Date on website - wordpress

I am building a website which will be viewed in UK, USA, and Europe, and want to know the best short date format to use.
I have been reading http://www.w3.org/QA/Tips/iso-date which reads...
*The international format defined by ISO (ISO 8601) tries to address all these problems by defining a numerical date system as follows:
YYYY-MM-DD where YYYY is the year [all the digits, i.e. 2012]
MM is the month [01 (January) to 12 (December)]
DD is the day [01 to 31]
For example, "3rd of April 2002", in this international format is written:
2002-04-03.*
...but still think that leaves room for error. The best I have seen is the BBC website uses "Thursday, 30 July" for example. Any suggestions?
Also, are there any Wordpress plugins that will handle this for me?

Ive used this plugin before https://wordpress.org/plugins/date-and-time-widget/screenshots/ which worked well (site is down now).
I agree with Zdeněk Šimůnek that you don't need the year. This plugin caters for all outputs really well.
If you want to manually add it with php, this is a good tutorial http://www.cyberciti.biz/faq/howto-finding-current-date-time-in-php/.

The BBC style is by me the best. If you were to write the month in number you would come to situation, where viewers in Europe would think that its for example 1st of February and in USA 2nd of January. Year is not needed as almost everybody knows what year it is. The day of the week is optional.
PS.: Many sites also writes a name day for current datum.

Related

DialogFlow wrong year when no year is specified

I am currently trying to create my own Google Agent using DialogFlow and while everything is going fine, I am finding myself unable to solve the smallest of problems.
Google has a tendency to add an additional year to the datetime object whenever I state a date. An example:
If I say "How much did we produce 29/6?" (6/29 doesn't work either) it will grab the date and format it correctly to the 6th of June, however it will make it year 2021 instead of 2020... Is there any way to make it default to our current year, unless I specifically say a different year?
Can you try saying "How much did we produce on June 29th?" I think it may have some issue processing the string "29/6" and somehow it gets translated to 6th of June.
You had mentioned "6th of June" is formatted correctly when giving "29/6", shouldn't it be "29th of June"?

Is "just a date without time" really a valid concept in the light of internationalization?

I always had conceptual troubles with date values being represented as objects without time (SQL for instance has the type DATE beside DATETIME). The same thinking often creates issues in languages that always store dates along with a time (e.g. C#'s DateTime). Suddenly timezone bugs pop up and the developers insist that all that timezone hullabaloo can be ignored, because their DateTime is actually "just a date". But what does that even mean?
The way I see it, such a "plain date" can be interpreted in only two ways:
From the perspective of points in time (i.e. "instants") one might infer that "2019-09-17" means the start (end) of the day, which is "2019-09-17 00:00:00" ("2019-09-17 23:59:59"). Hence timezone information is relevant and we are not talking about "just a date".
The other option is that the date is supposed to mean the whole day, so we are actually talking about a timespan from "2019-09-17 00:00:00" to "2019-09-17 23:59:59" and timezone information cannot be ignored either.
I argue that all use cases for "plain dates" fall in either of the two categories and that time/timezone can only be ignored if the software will only run on and communicate with systems configured with the exact same timezone.
Can someone provide a counter example or a third interpretation?
The "holiday" is an example of a date without a time, and even without a time zone.
Most holidays are religious in nature, and I don't want to start a religious war, or get sidetracked by minutiae. So as an example holiday, I'm going to pick Earth Day: April 22 of each year in the civil calendar.
If you write software that deals with holidays, said software isn't necessarily dealing with an instant in time across the entire planet (though it could do that in addition to tracking holidays). Instead it carries the concept that maps April 22 of each year to Earth Day. And it is irrelevant that some people will celebrate Earth Day hours before or after other people.
If a client wants to know exactly when Earth Day starts/ends for him, then he can translate "the date" into specific instants of time using his particular time zone. The need for that translation does not diminish the value of the date (say 2020-04-22).
C++20 will have several types to represent a "timezone-less date" such as 2020-04-22 using different data structures:
local_days // day 18374 == April/22/2020
year_month_day // year 2020, month 4, day 22 == April/22/2020
year_month_weekday // year 2020, month 4, 4th Wed == April/22/2020

Time Zone Issues with Calculating Daily and Yearly Profit

OK here is a hardcore question that me and my friend are debating the proper programming solution for.
Let's say I'm running a business in New York at time UTC-4.
My sales rep based in San Francisco, whose time is 11:00 PM on December 31st, 2013 (which is 1:00 AM, January 1st, 2014 in my time) makes a sale that nets the company $1,000,000 USD. He enters the sale in the system as happening on December 31st, 2013, but really, in my time, it happens on January 1st, 2014.
For my 2013 report, do I include the $1,000,000 USD as profit, or does that go in my 2014 report?
A related question to hone in on the problem... how do most companies calculate daily sales for December 31st? Is it the last 24 hours from midnight in the company's HQ timezone, or is it for December 31st from each of it's market's time zones aggregated?
Further, if you only have the date (YYYY-MM-DD) entered for a sale, how should that be converted stored in UTC, being that a UTC day spreads over two unique dates?
Here's a helpful tool I've used to analyze this question:
http://everytimezone.com/#2013-8-27,-420,6bj
From a practical perspective:
It probably wouldn't matter which business day you recorded the sale. Many business end their days early, not necessarily at the stroke of midnight.
Some businesses might use the time zone of their headquarters, and some might use the time of the location where the sale was made. Either approach might be valid.
Of course, if this is an actual concern then you should ask an accountant or tax attorney. The answer may be different depending on your industry, state, or country.
As far as the technical parts to your question:
A date without a time or time zone is just a date. Think of it as a logical position on a calendar - not as a unique moment of instantaneous time.
Without additional context, you can't convert it to UTC. Or any other time zone for that matter.
Since UTC is a timekeeping system and not a time zone, then technically there is no such thing as a UTC day, but that is just semantics. Still, the idea of a "UTC day" would still only cover one calendar "date" - since that is part of the definition of what a "date" is.
It's just that the "UTC day" doesn't align with a "New York day". Just like a "New York day" doesn't align perfectly with a "Los Angeles day".
To blow your mind even more, consider that not every local day is 24 hours. Due to daylight saving time transitions, a "day" might by 23, 23.5, 24 24.5, or 25 hours long. Of course most are "standard days" - which are exactly 24 hours.
If you can keep separate that local time is a position on a calendar, while instantaneous time is universal, then you will find that it all makes sense.
That site you referenced has a nice visualization, and I reference it a lot. But IMHO it should have a different name because it doesn't cover every time zone. Use it carefully. See the IANA database discussed the timezone tag wiki, which has over 500 zones.
I don't know what language or database you are using, but you may find the concepts I described recently in this post on working with Date and Time in RavenDB useful. Specifically, read the section titled "Time Zone Conversions". Even if you use some other technology, the same concepts will apply.

Somaliland Country Abbreviation

I can't find a two letter country abbreviation for Somaliland, likely because it's not a country, but rather, as Wikipedia puts it: "an unrecognized self-declared de facto sovereign state that is internationally recognized as an autonomous region of Somalia". Nevertheless, it still takes up space on a map.
This may not seem like a programming question, but it is. I'm using the jvectormap jQuery plugin, which accounts for this region and has assigned it the abbreviation "_3" in lieu of a two letter abbreviation. The problem is that in order to make jvector map function correctly with my code, I need to enter Somaliland into our database but I don't want to use "_3" as its abbreviation, and I also don't want to just make something up.
First and foremost, is there an official two letter abbreviation for Somaliland?
As trivial and petty as this problem may sound, it's created a paradox in my mind and is causing my brain to melt. How can this be handled "correctly" if an official abbreviation does not exist?
The two-letter country code for Somalia is SO. ISO added it to ISO 3166 after it received the "UN notification of full name" in July 2013. See Somalia in ISO's Online Browsing Platform.
In the Country Codes Collection, SO has a green colour code for "Officially assigned code elements".
The ISO country codes collection does not have an entry for Somaliland. The Wikipedia article ISO 3166-2:SO (i.e. Somalia's country code) states - without citing a source -
The autonomous regions of Somaliland and Puntland (the former of which claims independence but is not recognized by any nation) each span several regions and have no separate codes.
Based on the ISO registry, this appears to be correct. jVectorMap gives Somaliland the code XS; in the ISO registry defines, two-letter codes starting with X are "User-assigned code elements". Using XS for Somaliland appears to be safe in the context of jVectorMap, but there is no guarantee that other libraries or programs will use the same two-letter code.
Somaliland is not listed by the Nations Online Project either.
After visiting Somaliland, the journalist Joshua Keating, writing in The Guardian of 20 July 2018:
(...), according to the US Department of State, the United Nations, the African Union and every other government on Earth, I was not in Somaliland, a poor but stable and mostly functional country on the Horn of Africa. I was in Somalia.
(...)
As Somalilanders will often remind you, it was, in the past, an independent country, fully recognised by the international community, including the UN. But this halcyon period lasted less than a week. On 26 June 1960, the former Protectorate of Somaliland became fully independent from British rule, its independence recognised by 35 countries around the world, including the US. The next day, its new legislature passed a law approving a union with the south. On 1 July, Somalia became independent from Italy, and the two were joined together. It is a decision Somaliland has regretted almost ever since.
See also
25 years on, Somaliland struggles for recognition by Deutsche Welle, August 2016.
Why Somaliland is not a recognised state by The Economist, November 2015.
Somaliland's own recognition campaign.

can 2 timezone be for 1 city?

I want to know if there can be 2 or more GMT timezones for one city or state. I know there can be more then one GMT timezone for a country, but not sure if it's for state and city too. Share your knowledge please.
Interpreting the question to mean 'are there any cities which are in more than one time zone', then the answer is 'yes'. And there are American states with multiple time zones (Indiana and Arizona being two of them).
There has been recent discussion on the TZ mailing list about the area of China known as Xinjiang, which has a mixed population of Han Chinese and of Uyghurs. It seems that the Han use the standard Chinese time zone (Asia/Beijing), but the Uyghurs often use a local time zone. This is now encapsulated in the Olson database, with the name Asia/Urumqi for the Uyghur time zone.
So, for example, the zone.tab file in tzdata2010b.tar.gz, available from ftp://elsie.nci.nih.gov/pub/tzdata2010b.tar.gz (the code is ftp://elsie.nci.nih.gov/pub/tzcode2009t.tar.gz). There is an extensive description of how and why the change was made in the asia file.
Note that the Olson (Time Zone) database is now (2016-09-19) available from IANA at https://www.iana.org/time-zones rather than from NIH. You can get the current release easily enough; getting historical releases may be harder.
Yes, time zones really do change 20 times a year around the world, and sometimes at essentially no notice (that is, the government legislates the changes only a day or two before the change).
#basit asks:
Wow about the 20 times a year around the world. I'm trying to log the timezone for latitude and longitude, so now my question would be, how long should I log the data for? 6 months? 1 month? 2.. 3..?
And also, how long does it take for daylight savings to change in a year, because I need to log timezone with daylight saving and refresh the data after certain given period.
What I mean is that during the course of 2009, there were 20 issues of the time zone database, because of changes in rules in at least that many places. However, any given country usually only changes their rules once - though with Argentina, different states were changing their rules at different times and compounding the problems.
I'm not clear that we have enough information to tell you how long to log the data for. I'd be inclined to say at least 12 months, but it depends what you are going to do with it. At one level, all you need to do is keep up with the Olson database - that will tell you the time zone rules for essentially everywhere in the world. If you are interested in tracking the time zones of your visitors, then you can keep the data for as long as you like. Since not everyone uses the canonical Continent/City notation for their time zone (I tend to use the older US/Pacific notation, for instance - which is still supported, but is equivalent to America/Los_Angeles). The classical notations such as TZ=EST5EDT are ambiguous; both the USA and Australia have timezones that use EST as an abbreviation, and the dates when the switch between standard and daylight saving time occurs varies (witness the mass of data in the Olson database).
You also ask 'how long does it take for a time zone to change'. I'm not sure what you mean. In terms of 'when the clocks change (between standard and daylight saving time)', it is 'instantaneous'; one second it is one time zone offset; the next second it is the other. If you mean 'how long does it take for governments to change their mind', it varies radically. For example, both Europe and the USA have relatively fixed rules that change every few years; the rule in the USA had been stable for about 20 years, then they changed the rules about 3 years ago. Europe is similar. On the other hand, some countries change their rules yearly. My impression is that some of the Islamic countries adjust when they switch between standard and daylight saving time (or vice versa) depending in part on when Ramadan falls - if the change would occur during Ramadan, then they bring it forward, or delay it, so that the rule does not change during Ramadan. Other countries have different reasons for the brinksmanship that goes on - maybe it is the political equivalent of a release deadline. So it may take quite a while for people to decide what the 'final' (meaning 'next edition') of the rules will be for a given year.
The web site http://worldtimezone.com/ does a pretty good job of keeping track of most of these idiosyncracies.
I think you mean "Can one city or state span two time zones?". Yes. Mexico Beach, FL sits on the border between CST and EST with parts of the town in both time zones.
As for how you could tell a computer that, no idea.
There is only one gmt for the whole world. As for timezones, see here, showing variation of observance e.g. within Kansas.
Any arbitrary jurisdiction may have multiple timezones, though the majority do not.
Have a look at http://www.worldtimezone.com/faq.html

Resources