Project

General

Profile

Actions

Feature #643

closed

date -R support would be helpful

Added by Garrett D'Amore about 12 years ago. Updated almost 12 years ago.

Status:
Resolved
Priority:
Normal
Category:
cmd - userland programs
Start date:
2011-01-18
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:
needs-triage
Gerrit CR:
External Bug:

Description

This is a request for a GNUism. It is used by certain debian scripts like dch:

-R, --rfc-2822            output date and time in RFC 2822 format.
Example: Mon, 07 Aug 2006 12:34:56 -0600
--rfc-3339=TIMESPEC output date and time in RFC 3339 format.
TIMESPEC=`date', `seconds', or `ns' for
date and time to the indicated precision.
Date and time components are separated by
a single space: 2006-08-07 12:34:56-06:00

I'd be happy with just -R, although I can see that the other option may be quite useful as well.

Also, I notice that GNU date has %N, which is a time in nanoseconds. Perhaps this would be useful to obtain high resolution times?


Related issues

Has duplicate illumos gate - Bug #876: /bin/date missing -R keyClosed2011-04-02

Actions
Actions #1

Updated by Alexander Eremin about 12 years ago

  • Assignee set to Alexander Eremin
Actions #2

Updated by Roland Mainz about 12 years ago

For the log:
-R is basically the format "%a, %-e %h %Y %H:%M:%S %z". The only issue is to check whether any of these strings is subject to localisation.

Actions #3

Updated by Alexander Eremin almost 12 years ago

  • Assignee changed from Alexander Eremin to Roland Mainz
Actions #4

Updated by Garrett D'Amore almost 12 years ago

  • Difficulty set to Medium
  • Tags set to needs-triage

As documented, date -R is rfc 822, and that is not subject to localization.

Actions #5

Updated by Garrett D'Amore almost 12 years ago

Furthermore, Linux date behaves with -R as:
"%a, %d %h %Y %H:%M:%S %z"

(Note that %d instead of %-e.) This is verified with

velocity{12}> date --version
date (GNU coreutils) 8.5

Actions #6

Updated by Garrett D'Amore almost 12 years ago

  • Assignee changed from Roland Mainz to Garrett D'Amore

Taking this away from Roland due to lack of progress. I have a diff ready.

Actions #7

Updated by Garrett D'Amore almost 12 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100
  • Difficulty changed from Medium to Bite-size

Fixed in:

changeset: 13359:10bc9c3abe6e
tag: tip
user: Garrett D'Amore <>
date: Mon May 02 11:46:10 2011 -0700
description:
643 date -R support would be helpful
Reviewed by: Jason King <>
Reviewed by: Yuri Pankov <>
Reviewed by: Dan McDonald <>
Reviewed by: Kartik Mistry <>
Reviewed by: Rich Lowe <>
Approved by: Gordon Ross <>

Actions

Also available in: Atom PDF