How would you compute an xsd:dateTime in a shell script.

I can see several candidates :

$ date --iso-8601=seconds -u

but this option seems deprecated, or :

$ date --rfc-3339=seconds -u
2013-01-31 16:06:29+00:00

Both don't return the same result... so... are there any hints I've overlooked ?

asked 31 Jan '13, 11:09

olberger's gravatar image

accept rate: 0%

Both are wrong in the detail for an xsd:dateTime.

--iso-8601=seconds has timezone as 0000, not 00:00

--rfc-3339=seconds has a space

take control and use a format:

date +'%Y-%m-%dT%H:%M:%S%:z'

or more concisely:

 date '+%FT%T%:z'
permanent link

answered 31 Jan '13, 13:56

AndyS's gravatar image

AndyS ♦
accept rate: 33%

edited 31 Jan '13, 14:00


Perfect. Thanks alot.

(31 Jan '13, 14:42) olberger olberger's gravatar image

@olberger If this answer solved your problem don't forget to accept it, click the tick mark under the vote up/down buttons

(01 Feb '13, 05:03) Rob Vesse ♦ Rob%20Vesse's gravatar image
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 31 Jan '13, 11:09

question was seen: 1,157 times

last updated: 01 Feb '13, 05:03