Monday, November 08, 2010 at 12:02 AM.
system.verbs.builtins.date.netStandardString
on netStandardString (localDate) { <<Thursday, November 11, 1999 at 2:31:14 AM by AR <<Implemented as a kernel verb in Frontier 6.1. <<Old code <<on netStandardString (localDate) <<Return a string that looks like: Sat, 29 Nov 1997 00:51:47 GMT <<It's the worldwide Internet standard formatting for strings. <<The parameter, a date, is assumed to be a date in the local time zone. <<Convert it to the GMT version of the date, then build the formatted string. <<I did a bunch of email back and forth with Alan German on this. <<For a spec see http://www.informatik.uni-halle.de/www/http/HTTP1.0-ID_15.html#HEADING14 << <<local (ctz = date.getCurrentTimeZone ()) <<local (gmtDate = localDate - ctz) << <<if localDate >= 0 and gmtDate < 0 //check for wrap-around <<gmtDate = date (0) << <<local (day, month, year, hour, minute, second) <<date.get (gmtDate, @day, @month, @year, @hour, @minute, @second) << <<local (s) <<case date.dayOfWeek (gmtDate) <<1 <<s = "Sun" <<2 <<s = "Mon" <<3 <<s = "Tue" <<4 <<s = "Wed" <<5 <<s = "Thu" <<6 <<s = "Fri" <<7 <<s = "Sat" <<s = s + ", " + string.padWithZeros (day, 2) + " " <<case month <<1 <<s = s + "Jan" <<2 <<s = s + "Feb" <<3 <<s = s + "Mar" <<4 <<s = s + "Apr" <<5 <<s = s + "May" <<6 <<s = s + "Jun" <<7 <<s = s + "Jul" <<8 <<s = s + "Aug" <<9 <<s = s + "Sep" <<10 <<s = s + "Oct" <<11 <<s = s + "Nov" <<12 <<s = s + "Dec" <<s = s + " " + year + " " <<s = s + string.padWithZeros (hour, 2) + ":" <<s = s + string.padWithZeros (minute, 2) + ":" <<s = s + string.padWithZeros (second, 2) + " GMT" <<return (s) kernel (date.netStandardString)} <<bundle //test code <<dialog.notify (date.netStandardString (clock.now ()))
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.