Monday, November 08, 2010 at 12:02 AM.
system.verbs.builtins.date.hourToString
on hourToString (hournum) { //3/9/00; 7:19:26 AM by DW
if (hournum < 0) or (hournum > 23) {
scriptError ("Can't convert " + hournum + " to a string because it is not between 0 and 23.")};
local (adrdatatable = @user.prefs.dates);
if not defined (adrdatatable^) {
new (tableType, adrdatatable)};
local (adrlist = @adrdatatable^.hourNames);
if not defined (adrlist^) {
adrlist^ = {"Midnight", "1AM", "2AM", "3AM", "4AM", "5AM", "6AM", "7AM", "8AM", "9AM", "10AM", "11AM", "Noon", "1PM", "2PM", "3PM", "4PM", "5PM", "6PM", "7PM", "8PM", "9PM", "10PM", "11PM"}};
return (adrlist^ [hournum + 1])}
<<bundle //test code
<<dialog.alert (hourToString (12))
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.