示例#1
0
    public static IRubyObject prepareRubyTimeFromSqlDate(Ruby runtime, Date date) {

        if (date.getTime() + 3600000 == 0) {
            return runtime.getNil();
        }
        RubyTime rbTime = RubyTime.newTime(runtime, date.getTime());
        rbTime.extend(new IRubyObject[]{runtime.getModule("TimeFormatter")});
        return rbTime;
        // SimpleDateFormat sdf = new SimpleDateFormat("HH-mm-ss"); // TODO proper format?
        // return runtime.newString(sdf.format(rbTime.getJavaDate()));
    }
示例#2
0
 public static IRubyObject parse_date_time(Ruby runtime, Timestamp ts) {
     RubyTime time = RubyTime.newTime(runtime, ts.getTime());
     time.extend(new IRubyObject[] {runtime.getModule("DatetimeFormatter")});
     return time;
 }
示例#3
0
 public static IRubyObject parse_time(Ruby runtime, Time tm) {
     RubyTime time = RubyTime.newTime(runtime, tm.getTime());
     time.extend(new IRubyObject[] {runtime.getModule("TimeFormatter")});
     return (time.getUSec() != 0) ? time : runtime.getNil();
 }
示例#4
0
 public static IRubyObject parse_date(Ruby runtime, Date dt) {
     RubyTime time = RubyTime.newTime(runtime, dt.getTime());
     time.extend(new IRubyObject[] {runtime.getModule("DateFormatter")});
     return time;
 }