[Tutor] a DateTime object

Erik Price erikprice@mac.com
Sun Mar 2 13:06:01 2003


Hi,

What is a good way to take a user-supplied input string and convert it 
to a Unix timestamp (seconds since epoch)?  I know that the time module 
in stdlib offers both time() and mktime() but these both operate on 
"now", rather than some user-supplied datetime.

I am not really looking to implement this myself but rather if there is 
another module that does this kind of thing.  If not, I can probably 
come up with my own implementation without too much trouble, just don't 
feel like doing extra work.

(Use case: the user supplies the check-in and check-out times to a 
prompt.  These are then passed as arguments to a function that 
generates the timestamp, which is then stored internally in my object.  
It is easier for me to perform calculations on the timestamps, such as 
determining the duration of time between check-in and check-out, etc.)


Erik




-- 
Erik Price

email: erikprice@mac.com
jabber: erikprice@jabber.org