changed date-time separator to "T" and time-separator to dot

This commit is contained in:
vk 2009-06-01 17:37:41 +02:00
parent 5de2a7cb9b
commit 473f6cbf5e
2 changed files with 19 additions and 5 deletions

View file

@ -17,16 +17,16 @@ import re, os, time, logging, sys
from optparse import OptionParser
# global variables
PROG_VERSION = "0.0.5"
PROG_VERSION = "0.0.6"
FORMATSTRING_COMPACT = "%Y%m%d"
FORMATSTRING_STANDARD = "%Y-%m-%d"
FORMATSTRING_MONTH = "%Y-%m"
FORMATSTRING_WITHTIME = "%Y-%m-%d_%H:%M:%S"
FORMATSTRING_WITHTIME = "%Y-%m-%dT%H.%M.%S"
NODATESTAMP_PATTERN = re.compile('^\D')
COMPACT_PATTERN = re.compile('^\d{4,4}[01]\d[0123]\d[- _]')
STANDARD_PATTERN = re.compile('^\d{4,4}-[01]\d-[0123]\d[- _]')
MONTH_PATTERN = re.compile('^\d{4,4}-[01]\d[- _]')
WITHTIME_PATTERN = re.compile('^\d{4,4}-[01]\d-[0123]\d[ :_-][012]\d:[012345]\d:[012345]\d[- _]')
WITHTIME_PATTERN = re.compile('^\d{4,4}-[01]\d-[0123]\d[T :_-][012]\d:[012345]\d:[012345]\d[- _]')
# cmdline parsing
USAGE = "\n\
@ -40,6 +40,10 @@ If an existing timestamp is found, its style will be converted to the\n\
selected ISO datestamp format but the numbers stays the same.\n\
Executed with an examplefilename \"file\" this results e.g. in\n\
\"2008-12-31_file\".\n\
Note: Other that defined in ISO 8601+ the delimiter between hours,\n\
minutes, and seconds is not a colon but a dot. Colons are causing\n\
several problems on different file systems and are there fore replaced\n\
with the (older) DIN 5008 version with dots.\n\
\n\
Run %prog --help for usage hints"
@ -59,7 +63,7 @@ parser.add_option("--month", dest="month",
help="use datestamp with year and month (YYYY-MM)")
parser.add_option("--withtime", dest="withtime",
action="store_true",
help="use datestamp including seconds (YYYY-MM-DD_hh:mm:ss)")
help="use datestamp including seconds (YYYY-MM-DDThh.mm.ss)")
# parser.add_option("-r", "--remove", dest="remove",
# action="store_true",
# help="remove all known datestamps")

View file

@ -60,7 +60,7 @@ Use datestamp format with year and month: YYYY-MM
*--withtime*::
Use long datestamp format including timestamp: YYYY-MM-DD_hh:mm:ss
Use long datestamp format including timestamp: YYYY-MM-DDThh.mm.ss
*-m*, *--mtime*::
@ -118,11 +118,21 @@ Add datestamps to all files beginning with "20" in the current directory in the
format YYYY-MM or (more likely due to the "20"-condition) modify known
datestamps to the YYYY-MM one.
Note on timestamp format including time
---------------------------------------
Other that defined in ISO 8601+ the delimiter between hours, minutes, and
seconds is not a colon but a dot. Colons are causing several problems on
different file systems and are there fore replaced with the (older) DIN 5008
version with dots.
Online Ressources
-----------------
Check out the link:http://Karl-Voit.at/scripts/#date2name[date2name webpage].
ISO 8601+ annoted and DIN 5008 link:http://www.cl.cam.ac.uk/~mgk25/iso-time.html[Cambridge Webpage]
Bugs
----
Please report feedback, bugreports and wishes <<X7,to the author>>.