From bce916fbcd90eb20fbb1a2affd86d3c5cc9ea844 Mon Sep 17 00:00:00 2001 From: Mitch Tishmack Date: Sat, 28 May 2016 21:42:50 -0500 Subject: [PATCH] Update iso8601 to output non : separated times --- bin.org | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/bin.org b/bin.org index d592840..78b3349 100644 --- a/bin.org +++ b/bin.org @@ -655,12 +655,19 @@ generally without depending on gnu date. use strict; use warnings; use POSIX qw(strftime); +use Getopt::Long; + +my $short = 0; +GetOptions('short' => \$short, + 's' => \$short + ); my $now = time; -my $tz = strftime(('%z', (localtime $now))); -$tz =~ s/(\d{2})(\d{2})/$1:$2/smx; -my $time = strftime('%Y-%m-%dT%H:%M:%S', (localtime $now)); -print "$time$tz\n"; +if ($short) { + print strftime('%Y%m%dT%H%M%SZ', (gmtime $now)) . "\n"; +} else { + print strftime('%Y-%m-%dT%H:%M:%SZ', (gmtime $now)) . "\n"; +} exit 0; #+END_SRC