Date string to UNIX time in SWI Prolog?
From: Michael David Pedersen (mdp_at_cs.auc.dk)
Date: 05/24/04
- Next message: Cesar Rabak: "Re: Date string to UNIX time in SWI Prolog?"
- Previous message: Andreas Kochenburger: "Re: Forth and Prolog"
- Next in thread: Cesar Rabak: "Re: Date string to UNIX time in SWI Prolog?"
- Reply: Cesar Rabak: "Re: Date string to UNIX time in SWI Prolog?"
- Reply: Jan Wielemaker: "Re: Date string to UNIX time in SWI Prolog?"
- Reply: Michael David Pedersen: "Re: Date string to UNIX time in SWI Prolog?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 24 May 2004 16:43:23 +0200
Hi all,
I am in desperate need of a way to translate a ISO 8601 date string in the
format 'YYYYMMDD' to the corresponding UNIX time stamp (i.e. seconds since
January 1st 1970.
The only relevant predicates which SWI seems to offer are:
convert_time(+Time, -Year, -Month, -Day, -Hour, -Minute, -Second, -MilliSeco
nds) and
convert_time(+Time, -String)
But these only allow converting from a unix time to some other
representation! I need to go the other way around, and I would like to avoid
writing this code my self (taking leap years into accound etc.). What to do?
One (unclean) solution is to use shell(+Command, -Status) to call an
external shell command which handles the conversion. If this is the best way
out, how would I go about receiving a return value?
Hope that someone has an answer -- any help will be greatly appreciated.
Regards,
Michael.
- Next message: Cesar Rabak: "Re: Date string to UNIX time in SWI Prolog?"
- Previous message: Andreas Kochenburger: "Re: Forth and Prolog"
- Next in thread: Cesar Rabak: "Re: Date string to UNIX time in SWI Prolog?"
- Reply: Cesar Rabak: "Re: Date string to UNIX time in SWI Prolog?"
- Reply: Jan Wielemaker: "Re: Date string to UNIX time in SWI Prolog?"
- Reply: Michael David Pedersen: "Re: Date string to UNIX time in SWI Prolog?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|