Skip to content
Tcl Source Code View Ticket
Login

View Ticket

[clock scan] allow / and . date-delims

Closed / Accepted489705ffffffffffffffffffffffffffffffffffCreated 25 years agoUpdated 22 years ago
Descriptionplain2001-12-06 04:18:15
The "clock scan" command should allow "/" and "." as 
date delimeters. I'm encountering dates from SQL 
databases formatted in this way, and periods in the 
date are increasing popular in globalized programs.

Eg: allow "2001.12.21" and "2001/12/21". 
Currently "2001-12-21" will work fine.

Today, I replace / and . with - to make these date 
types work with clock scan, like so:

   regsub -all {/} $sql_date_text {-} unSlashedDate
   regsub -all {\.} $unSlashedDate {-} unSlashedDate2
   set seconds [clock scan $unSlashedDate2]

this seem like a fairly straightforward change to the 
C code for "clock scan". I can make the patch and 
submit it, if that's preferred.

-john
dkf Ticket [489705ffff]: 2 changes [History diff]2001-12-06 16:48:41
dkf Ticket [489705ffff]: 1 change [History diff]2003-02-25 16:31:43
kennykbplain2004-08-19 22:40:35
Logged In: YES 
user_id=99768

Tcl 8.5 allows considerably more flexibility in the
formats that [clock scan] can process - at the
expense of needing to tell it (via a -format option)
about the format you expect to process.
Parsing with - and . is trivial.
kennykb Ticket [489705ffff]: 2 changes [History diff]2004-08-19 22:40:36
Log in (anonymous is fine) to add a comment.