Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What Does A Letter Delimiter in a date String Do (Besides Delimit)?

Tags:

date

bash

I'm using bash 4.1. I am using a letter to delimit the date and the time fields of a date string to be converted by date. It appears that each letter causes a different value (from -5 to +18) to be added to the time specified. But note that J results in an error. I cannot find an explanation for this behaviour in either the man or the info pages. Can someone enlighten me?

$ date -d 2014-01-01A00:00:00
Tue Dec 31 19:00:00 CST 2013
$ date -d 2014-01-01B00:00:00
Tue Dec 31 20:00:00 CST 2013
$ date -d 2014-01-01C00:00:00
Tue Dec 31 21:00:00 CST 2013
$ date -d 2014-01-01D00:00:00
Tue Dec 31 22:00:00 CST 2013
$ date -d 2014-01-01E00:00:00
Tue Dec 31 23:00:00 CST 2013
$ date -d 2014-01-01F00:00:00
Wed Jan  1 00:00:00 CST 2014
$ date -d 2014-01-01G00:00:00
Wed Jan  1 01:00:00 CST 2014
$ date -d 2014-01-01H00:00:00
Wed Jan  1 02:00:00 CST 2014
$ date -d 2014-01-01I00:00:00
Wed Jan  1 03:00:00 CST 2014
$ date -d 2014-01-01J00:00:00
date: invalid date `2014-01-01J00:00:00'
$ date -d 2014-01-01K00:00:00
Wed Jan  1 04:00:00 CST 2014
$ date -d 2014-01-01L00:00:00
Wed Jan  1 05:00:00 CST 2014
$ date -d 2014-01-01M00:00:00
Wed Jan  1 06:00:00 CST 2014
$ date -d 2014-01-01N00:00:00
Tue Dec 31 17:00:00 CST 2013
$ date -d 2014-01-01O00:00:00
Tue Dec 31 16:00:00 CST 2013
$ date -d 2014-01-01P00:00:00
Tue Dec 31 15:00:00 CST 2013
$ date -d 2014-01-01Q00:00:00
Tue Dec 31 14:00:00 CST 2013
$ date -d 2014-01-01R00:00:00
Tue Dec 31 13:00:00 CST 2013
$ date -d 2014-01-01S00:00:00
Tue Dec 31 12:00:00 CST 2013
$ date -d 2014-01-01T00:00:00
Tue Dec 31 11:00:00 CST 2013
$ date -d 2014-01-01U00:00:00
Tue Dec 31 10:00:00 CST 2013
$ date -d 2014-01-01V00:00:00
Tue Dec 31 09:00:00 CST 2013
$ date -d 2014-01-01W00:00:00
Tue Dec 31 08:00:00 CST 2013
$ date -d 2014-01-01X00:00:00
Tue Dec 31 07:00:00 CST 2013
$ date -d 2014-01-01Y00:00:00
Tue Dec 31 06:00:00 CST 2013
$ date -d 2014-01-01Z00:00:00
Tue Dec 31 18:00:00 CST 2013
like image 574
CPRitter Avatar asked Feb 17 '14 20:02

CPRitter


People also ask

What is the use of delimiter in string?

In Java, delimiters are the characters that split (separate) the string into tokens. Java allows us to define any characters as a delimiter. There are many string split methods provides by Java that uses whitespace character as a delimiter. The whitespace delimiter is the default delimiter in Java.

What is a delimiter used for?

A delimiter is a sequence of one or more characters for specifying the boundary between separate, independent regions in plain text, mathematical expressions or other data streams.

What is a delimiter string?

A delimiter is one or more characters that separate text strings. Common delimiters are commas (,), semicolon (;), quotes ( ", ' ), braces ({}), pipes (|), or slashes ( / \ ).

What is a delimiter and what purpose does it serve in a file?

In computer programming, a delimiter is a character that identifies the beginning or the end of a character string (a contiguous sequence of characters). The delimiting character is not part of the character string.

What is a delimiter in a string?

A delimiter is one or more characters that separate text strings. Common delimiters are commas (,), semicolon (;), quotes ( ", ' ), braces ({}), pipes (|), or slashes ( / \ ).

How to split string in Java with delimiter?

In Java, splitting string is an important and usually used operation when coding. Java provides multiple ways to split the string. But the most common way is to use the split () method of the String class. In this section, we will learn how to split a String in Java with delimiter.

What is the default delimiter in Java?

What is a delimiter? In Java, delimiters are the characters that split (separate) the string into tokens. Java allows us to define any characters as a delimiter. There are many string split methods provides by Java that uses whitespace character as a delimiter. The whitespace delimiter is the default delimiter in Java.

What is delimited text in C with example?

When a program stores sequential or tabular data, it delimits each item of data with a predefined character. Delimited text example. For example, in the data "john|doe," a vertical bar (the pipe character, |) delimits the two data items john and doe.


2 Answers

Look at the letters sorted by their associated time:

YXWVUTSRQPON Z ABCDEFGHIKLM

I highlighted Z because this is (in your example) Wed Jan 1 00:00:00 GMT 2014. A-M represent timezones west (later) than GMT, N-Y timezones east (later). so you get GMT, 12 timezones east and 12 west, which makes 25. J just happens to be the letter that was left out, for whatever reason.

like image 185
Silly Freak Avatar answered Nov 12 '22 07:11

Silly Freak


GNU date follows RFC 822 or ISO 8601. In RFC 822 (obsolete), as described in the superseding document RFC 2822, military time zones were defined:

The 1 character military time zones were defined in a non-standard way in [RFC822] and are therefore unpredictable in their meaning. The original definitions of the military zones "A" through "I" are equivalent to "+0100" through "+0900" respectively; "K", "L", and "M" are equivalent to "+1000", "+1100", and "+1200" respectively; "N" through "Y" are equivalent to "-0100" through "-1200" respectively; and "Z" is equivalent to "+0000". However, because of the error in [RFC822], they SHOULD all be considered equivalent to "-0000" unless there is out-of-band information confirming their meaning.

In RFC 822, this was known as the "hour zone". The comment in RFC 822 calls it this and defines it as either "ANSI or Military".

From RFC 822:

The military standard uses a single character for each zone. "Z" is Universal Time. "A" indicates one hour earlier, and "M" indicates 12 hours earlier; "N" is one hour later, and "Y" is 12 hours later. The letter "J" is not used.

This all makes sense because it is likely that RFC 822 was written around the time of ARPANET and ARPANET came out of DoD circles.

Here is a list of military time zones.

By the way, Local time is specifically designated in the military as zone J or "Juliet".

like image 43
Engineer2021 Avatar answered Nov 12 '22 08:11

Engineer2021