Date Manipulation Does Not work? 
Author Message
 Date Manipulation Does Not work?

The command :
clock format [expr [clock scan "Jan 18 2001"] -
86400] -format "%b %d %Y"  Works Great
It returns Jan 17 2001

But changing the year to 2003 "Jan 18 2003"
Returns back Jan 17 2001

If I put in a date of "Jan 01 2003" I think I
would expect to see Dec 31 2002, but I get
Dec 31 2000

What am I missing?

I am still new to TCL and would appreciate any
help.
Thanks
Alex



Tue, 08 Jul 2003 12:09:33 GMT  
 Date Manipulation Does Not work?
I also attempted this:
set New [clock scan "Jan 01 1999"]
set NewNew [clock scan "-1 day" -base $New]
clock format $NewNew -format "%b %d %Y"

It returns back :
Dec 31 2000 and not Dec 31 1998


Quote:
> The command :
> clock format [expr [clock scan "Jan 18 2001"] -
> 86400] -format "%b %d %Y"  Works Great
> It returns Jan 17 2001

> But changing the year to 2003 "Jan 18 2003"
> Returns back Jan 17 2001

> If I put in a date of "Jan 01 2003" I think I
> would expect to see Dec 31 2002, but I get
> Dec 31 2000

> What am I missing?

> I am still new to TCL and would appreciate any
> help.
> Thanks
> Alex



Tue, 08 Jul 2003 12:28:07 GMT  
 Date Manipulation Does Not work?

Quote:

> clock format [expr [clock scan "Jan 18 2001"] - 86400] -format "%b %d %Y"
> It returns Jan 17 2001

> But changing the year to 2003 "Jan 18 2003"
> Returns back Jan 17 2001
...
> What am I missing?

Add a comma after "Jan 18".  As you have the dates formatted,
the 2001 is interpreted as 8:01 pm and 2003 as 8:03pm. In
either case, the year is assumed by default to be the current year.
Adding a comma resolves the ambiguity another way.

--
| Don Porter          Mathematical and Computational Sciences Division |

| http://math.nist.gov/~DPorter/                                  NIST |
|______________________________________________________________________|



Tue, 08 Jul 2003 12:29:53 GMT  
 Date Manipulation Does Not work?


Quote:
>The command :
>clock format [expr [clock scan "Jan 18 2001"] -
>86400] -format "%b %d %Y"  Works Great
>It returns Jan 17 2001

>But changing the year to 2003 "Jan 18 2003"
>Returns back Jan 17 2001

>If I put in a date of "Jan 01 2003" I think I
>would expect to see Dec 31 2002, but I get
>Dec 31 2000

>What am I missing?

From the Tcl Help:
  date
    A specific month and day with optional year.  The acceptable formats
    are mm/dd?/yy?, monthname dd ?, yy?, dd monthname ?yy?, day, dd
    monthname yy, ?CC?yymmdd, ?CC?yy-mm-dd, dd-monthname-?CC?yy. The
    default year is the current year.

The way you're specifying the date is not an acceptable form for a date
only. The clock command interprets you're dates as 18 Jan <ThisYear>
20:01

This means that all your computations results in extracting 24 hours
from different times of 18 Jan this year. And that is of course always
17 Jan.

Ingemar Hansson



Tue, 08 Jul 2003 15:44:43 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. dATE AND TIME PICKER ACTIVEX NOT WORKING

2. Unix system g77 calls DATE and TIME not working for Alpha/Linux

3. Date/Time Manipulation

4. Date Field Manipulation

5. Date Field Manipulation

6. Date manipulation in REXX for MVS

7. Date manipulation

8. Date manipulation in Rexx

9. Date manipulation functions or subroutines

10. date and time manipulation libraries

11. date/times manipulation package?

12. DATE manipulation

 

 
Powered by phpBB® Forum Software