public final class RubyDate
extends java.util.Date
RubyDate simply extends Java Date and adds few useful methods which
are inspired by Ruby on Rails.| Modifier and Type | Class and Description |
|---|---|
static class |
RubyDate.DateField
RubyDate.DateField is designed for change(Map) to use. |
class |
RubyDate.DateShifter
RubyDate.DateShifter shifts a Date by an interval of time and creates a new
RubyDate from it. |
| Constructor and Description |
|---|
RubyDate()
Returns a
RubyDate of now. |
RubyDate(java.util.Date date)
Creates a
RubyDate of given Date. |
| Modifier and Type | Method and Description |
|---|---|
RubyDate.DateShifter |
add(int interval)
Increases an interval of time to a date by the
RubyDate.DateShifter. |
RubyDate |
beginningOfDay()
|
RubyDate |
beginningOfMonth()
|
RubyDate |
beginningOfQuarter()
Returns a new
RubyDate representing the start of the quarter (1st
of january, april, july, october). |
RubyDate |
beginningOfWeek()
|
RubyDate |
beginningOfYear()
Returns a new
RubyDate representing the beginning of the year. |
RubyDate |
change(java.util.Map<RubyDate.DateField,java.lang.Integer> options)
Returns a new
RubyDate where one or more of the elements have been
changed according to the options parameter. |
static RubyDate |
current()
Creates a
RubyDate of current time. |
int |
day()
Returns the day(1-31) of this
RubyDate. |
int |
dayOfMonth()
Returns the day(1-31) of month of this
RubyDate. |
int |
dayOfWeek()
Returns the day(0-6) of week of this
RubyDate.Sun : 0 Mon : 1 Tue : 2 Wed : 3 Thur: 4 Fri : 5 Sat : 6 |
int |
dayOfYear()
Returns the day of year of this
RubyDate. |
RubyDate |
endOfDay()
|
RubyDate |
endOfMonth()
|
RubyDate |
endOfQuarter()
Returns a new
RubyDate representing the end of the quarter (last
day of march, june, september, december). |
RubyDate |
endOfWeek()
|
RubyDate |
endOfYear()
Returns a new
RubyDate representing the end of the year. |
boolean |
futureʔ()
Checks if this
RubyDate represents a future time. |
int |
hour()
Returns the hour(0-23) of this
RubyDate. |
int |
millisecond()
Returns the millisecond of this
RubyDate. |
RubyDate.DateShifter |
minus(int interval)
Decreases an interval of time to a date by the
RubyDate.DateShifter. |
int |
minute()
Returns the minute of this
RubyDate. |
int |
month()
Returns the month(1-12) of this
RubyDate. |
boolean |
pastʔ()
Checks if this
RubyDate represents a past time. |
int |
second()
Returns the second of this
RubyDate. |
static RubyDate |
today()
Creates a
RubyDate of beginning of today. |
boolean |
todayʔ()
Checks if this
RubyDate is a time of today. |
static RubyDate |
tomorrow()
Creates a
RubyDate of tomorrow. |
int |
week()
Returns the week of year of this
RubyDate. |
int |
weekOfMonth()
Returns the week of month of this
RubyDate. |
int |
year()
Returns the year of this
RubyDate. |
static RubyDate |
yesterday()
Creates a
RubyDate of yesterday. |
after, before, clone, compareTo, equals, getDate, getDay, getHours, getMinutes, getMonth, getSeconds, getTime, getTimezoneOffset, getYear, hashCode, parse, setDate, setHours, setMinutes, setMonth, setSeconds, setTime, setYear, toGMTString, toLocaleString, toString, UTCpublic RubyDate()
RubyDate of now.public RubyDate(java.util.Date date)
RubyDate of given Date.date - a Datejava.lang.NullPointerException - if date is nullpublic RubyDate change(java.util.Map<RubyDate.DateField,java.lang.Integer> options)
RubyDate where one or more of the elements have been
changed according to the options parameter.RubyDatepublic int year()
RubyDate.public int month()
RubyDate.public int day()
RubyDate.public int dayOfWeek()
RubyDate.public int dayOfMonth()
RubyDate.public int dayOfYear()
RubyDate.public int week()
RubyDate.public int weekOfMonth()
RubyDate.public int hour()
RubyDate.public int minute()
RubyDate.public int second()
RubyDate.public int millisecond()
RubyDate.public RubyDate.DateShifter add(int interval)
RubyDate.DateShifter.interval - of time to be shiftedRubyDate.DateShifterpublic RubyDate.DateShifter minus(int interval)
RubyDate.DateShifter.interval - of time to be shiftedRubyDate.DateShifterpublic RubyDate beginningOfWeek()
RubyDate with time set to the beginning of week based
on this RubyDate. The beginning of week is Sunday.RubyDatepublic RubyDate endOfWeek()
RubyDate with time set to the end of week based on
this RubyDate. The end of week is Saturday.RubyDatepublic RubyDate beginningOfQuarter()
RubyDate representing the start of the quarter (1st
of january, april, july, october).RubyDatepublic RubyDate endOfQuarter()
RubyDate representing the end of the quarter (last
day of march, june, september, december).RubyDatepublic RubyDate beginningOfYear()
RubyDate representing the beginning of the year.RubyDatepublic RubyDate endOfYear()
RubyDate representing the end of the year.RubyDatepublic boolean futureʔ()
RubyDate represents a future time.RubyDate represents a future time, false
otherwisepublic boolean pastʔ()
RubyDate represents a past time.RubyDate represents a past time, false
otherwisepublic boolean todayʔ()
RubyDate is a time of today.RubyDate is a time of today, false otherwise