JSX用strftime()/strptime()を書いた

// example/datetime.jsx
import "../lib/mizuki/datetime.jsx";

class _Main {
    static function main(args : string[]) : void {
        var d = new Date;

        if (args.length > 0) {
            DateTime.setLocale(args[0]);
        }

        var f = "[%a %b %d %Y %H:%M:%S.%3N GMT%z (%Z)]";

        var s = DateTime.strftime(d, f);
        log "strftime: " + s;
        log "strptime: " + DateTime.strftime(DateTime.strptime(s, f), f);
    }
}
// vim: set expandtab:
mizuki$ jsx --run example/datetime.jsx 
strftime: [Sat Jul 21 2012 14:27:25.524 GMT+0900 (JST)]
strptime: [Sat Jul 21 2012 14:27:25.524 GMT+0900 (JST)]
mizuki$ jsx --run example/datetime.jsx $LANG # LANG=ja_JP.utf8
strftime: [721 2012 14:28:55.552 GMT+0900 (JST)]
strptime: [721 2012 14:28:55.552 GMT+0900 (JST)]

もちろん、どのJavaScript処理系でも同じ出力になる。