Monday, November 08, 2010 at 12:02 AM.
system.verbs.builtins.file.getDatePath
on getDatePath (chseparator=file.getpathchar (), theDate=clock.now (), flLastSeparator=true) {
<<Changes
<<1/4/09; 6:37:24 PM by DW
<<New optional param, flLastSeparator, default true. If false, we don't include the last separator character. In some cases the days don't represent folders, they are files, so you don't want the separator character at the end.
<<6/15/07; 5:09:26 PM by DW
<<This code has been replicated for years in dozens of places.
local (day, month, year, hour, minute, second);
date.get (theDate, @day, @month, @year, @hour, @minute, @second);
month = string.padwithzeros (month, 2);
day = string.padwithzeros (day, 2);
if flLastSeparator { //1/4/09 by DW
return (year + chseparator + month + chseparator + day + chseparator)}
else {
return (year + chseparator + month + chseparator + day)}}
<<bundle //test code
<<dialog.alert (getDatePath ("/"))
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.