This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Why there is a little "+" in front of the number?  RSS feed

 
Matthew Han
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I just did a little funny code changing this morning, (a little curious), but I found the printout is this: +138915-08-06.
What does the plus sign mean here? Why it is not there when the year is smaller?

Thank you.
 
Stephan van Hulst
Saloon Keeper
Posts: 7805
142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's all in the documentation.

LocalDate.toString() wrote:
Outputs this date as a String, such as 2007-12-03.
The output will be in the ISO-8601 format uuuu-MM-dd.

Wikipedia wrote:
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 BCE and all others CE. 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."

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. 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 instead of the more common AD/BC (or BCE/CE) notation; by convention 1 BC is labelled +0000, 2 BC is labeled -0001, and so on.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!