rdiff-backup command creates incremental backups by creating several files with datestamps in their titles. The datestamps are of the format defined in the W3 Note about datetime, which are essentially:
Complete date plus hours, minutes and seconds:
YYYY-MM-DDThh:mm:ssTZD (eg 1997-07-16T19:20:30+01:00)
Where the T in the middle is a literal 'T' to denote that the time starts at this point.
I'd like to be able to mirror this format using the
date command. So far I have:
Which works brilliantly if I'm in any timezone other than GMT/UTC, giving the output in the expected format.
When in the GMT/UTC timezone, the timezone string at the end should be output as the letter
Z rather than the current
I'm sure I could do this by obtaining the timezone part with a separate
date command and changing it if it matches +00:00, or by using some sort of parameter expansion if I save the string as a variable, or maybe even using
tr. Is there a direct way within the
date command options, if not how should I achieve this simply?