Skip to content

Commit

Permalink
additional RFC822-style format (closes #21)
Browse files Browse the repository at this point in the history
  • Loading branch information
eddelbuettel committed Oct 23, 2016
1 parent 774f7b4 commit 69c1fe8
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
7 changes: 6 additions & 1 deletion ChangeLog
@@ -1,3 +1,8 @@
2016-10-23 Dirk Eddelbuettel <edd@debian.org>

* src/anytime.cpp (sformats[]): New format for RFC 822 style date
* tests/allFormats.R: New test

2016-10-22 Dirk Eddelbuettel <edd@debian.org>

* NAMESPACE: Adding utctime() and utcdate() to export()
Expand Down Expand Up @@ -54,7 +59,7 @@

2016-10-14 Dirk Eddelbuettel <edd@debian.org>

* src/anytime.cpp (sformats[]]): Add several new date(time) formats
* src/anytime.cpp (sformats[]): Add several new date(time) formats
of the 14OCT2016 variety, with and without hours/minutes

* tests/allFormats.R: Add new tests as well
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
@@ -1,8 +1,8 @@
Package: anytime
Type: Package
Title: Anything to 'POSIXct' or 'Date' Converter
Version: 0.0.4.1
Date: 2016-10-22
Version: 0.0.4.2
Date: 2016-10-23
Author: Dirk Eddelbuettel
Maintainer: Dirk Eddelbuettel <edd@debian.org>
Description: Convert input in any one of character, integer, numeric, factor,
Expand Down
3 changes: 3 additions & 0 deletions src/anytime.cpp
Expand Up @@ -60,6 +60,9 @@ const std::string sformats[] = {
// see http://stackoverflow.com/questions/39259184/formatting-dates-with-r for next one
"%a %b %d %H:%M:%S%F %Y",

// see RFC 822 and standard Unix use eg mail headers (but no TZ or UTC offset on input :-/ )
"%a %d %b %Y %H:%M:%S%F",

"%Y-%m-%d",
"%Y%m%d",
"%m/%d/%Y",
Expand Down
3 changes: 3 additions & 0 deletions tests/allFormats.R
Expand Up @@ -35,6 +35,9 @@ anytime(c("01.September.2016 10:11:12", "01.September.2016 10:11:12.345678"))
cat("\n")
anytime(c("Thu Sep 01 10:11:12 2016", "Thu Sep 01 10:11:12.345678 2016"))

cat("\n")
anytime(c("Thu 01 Sep 2016 10:11:12", "Thu 01 Sep 2016 10:11:12.345678"))

cat("\n")
anytime(c("2016-09-01", "20160901", "09/01/2016", "09-01-2016"))

Expand Down

0 comments on commit 69c1fe8

Please sign in to comment.