Monday, November 08, 2010 at 12:04 AM.
system.verbs.builtins.mainResponder.calendar.pathArgsToDate
<<Changes
<<2/8/99; 6:05:38 PM by DW
<<Turn a string like 1999/02/08 to a date
<<On Windows you can use the date verb to do this, but on Mac it doesn't work
<<This method works on both systems
<<Mon, 01 Mar 1999 13:10:46 GMT by AR
<<Copied to this place from mainResponder.discuss.pathArgsToDate.
<<Use mainResponder.calendar.dateToPathArgs as the reverse function.
on pathArgsToDate (pathargs) {
local (day, month, year);
year = number (string.nthField (pathargs, '/', 1));
month = number (string.nthField (pathargs, '/', 2));
day = number (string.nthField (pathargs, '/', 3));
return (date.set (day, month, year, 0, 0, 0))}
<<bundle //test code
<<dialog.alert (pathArgsToDate ("1999/02/08"))
This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.