Package com._1c.g5.v8.dt.mcore.util
Class Date
- java.lang.Object
-
- com._1c.g5.v8.dt.mcore.util.Date
-
- All Implemented Interfaces:
Comparable<Date>
public final class Date extends Object implements Comparable<Date>
Instance of this class represents date-time value containing year, month, day of month, hour, minute and second
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(Date other)
boolean
equals(Object obj)
static Date
fromJavaDate(Date date)
Creates date fromDate
static Date
fromString(String str)
CreatesDate
instance from string.static Date
getCurrentDate()
Returns current dateint
getDay()
int
getHour()
int
getMinute()
int
getMonth()
int
getSecond()
int
getYear()
int
hashCode()
static Date
toJavaDate(Date date)
CreatesDate
from dateString
toString()
-
-
-
Constructor Detail
-
Date
public Date(int year, int month, int day, int hour, int minute, int second)
Constructor- Parameters:
year
- must be 1..9999.month
- must be 1..12day
- must be 1..depends on monthhour
- must be 0..23minute
- must be 0..59second
- must be 0..59
-
Date
public Date(int year, int month, int day)
Constructor. Constructs instance containing only date without time. Hour, minute and second are set to 0.- Parameters:
year
- must be 1..9999.month
- must be 1..12day
- must be 1..depends on month
-
-
Method Detail
-
fromString
public static Date fromString(String str)
CreatesDate
instance from string. String should be presented as "YYYY-MM-DDTHH:MM:SS" or "YYYY-MM-DD"- Parameters:
str
- string containing date-time.- Returns:
- created
Date
instance
-
fromJavaDate
public static Date fromJavaDate(Date date)
Creates date fromDate
- Parameters:
date
-Date
value, must not be null- Returns:
- Date value
-
getCurrentDate
public static Date getCurrentDate()
Returns current date- Returns:
- Date value
-
getYear
public int getYear()
- Returns:
- year value
-
getMonth
public int getMonth()
- Returns:
- month value
-
getDay
public int getDay()
- Returns:
- day value
-
getHour
public int getHour()
- Returns:
- hour value
-
getMinute
public int getMinute()
- Returns:
- minute value
-
getSecond
public int getSecond()
- Returns:
- second value
-
compareTo
public int compareTo(Date other)
- Specified by:
compareTo
in interfaceComparable<Date>
-
-