使用范围:UI2
class Date ($UI/system/lib/base/date)
常用的日期操作
Constructor Top
Date () |
Static Properties & Enumerations Top
String |
DEFAULT_FORMAT
[filed]时间格式常量 = "yyyy/MM/dd hh:mm:ss" | ||
String |
DEFAULT_FORMAT1
[filed]时间格式常量 = "yyyy-MM-dd hh:mm:ss" | ||
String |
DEFAULT_FORMAT_SHOT
[filed]时间格式常量 = "yyyy/MM/dd" | ||
String |
STANDART_FORMAT
[filed]时间格式常量 = "yyyy-MM-ddThh:mm:ss.fffZ" | ||
String |
STANDART_FORMAT_SHOT
[filed]时间格式常量 = "yyyy-MM-dd" | ||
String |
UNIT_DAY
[filed]时间单位常量天 = "d" | ||
String |
UNIT_HOUR
[filed]时间单位常量小时 = "h" | ||
String |
UNIT_MINUTE
[filed]时间单位常量分钟 = "n" | ||
String |
UNIT_MONTH
[filed]时间单位常量月 = "m" | ||
String |
UNIT_QUARTER
[filed]时间单位常量度 = "q" | ||
String |
UNIT_SECOND
[filed]时间单位常量秒 = "s" | ||
String |
UNIT_WEEK
[filed]时间单位常量周 = "w" | ||
String |
UNIT_YEAR
[filed]时间单位常量 年 = "y" |
Static Methods Top
Number | between (Date start, Date end) | |
Integer | daysBetween (DateTime start, DateTime end) | |
Date | decrease (Date datetime, Number num, String interval) | |
Number | diff (Date start, Date end, String interval) | |
Integer | fromNowDays (DateTime date) | |
Integer | fromNowHours (DateTime date) | |
Integer | fromNowMinutes (DateTime date) | |
Integer | fromNowMonths (DateTime date) | |
Integer | fromNowSeconds (DateTime date) | |
Integer | fromNowYears (DateTime date) | |
Date | fromString (String str, String format) | |
Integer | getDate (DateTime date) | |
Integer | getDay (DateTime date) | |
Date | getFirstDay (Date date) | |
Integer | getFullYear (DateTime date) | |
Integer | getHour (DateTime date) | |
Date | getLastDay (Date date) | |
Integer | getMinutes (DateTime date) | |
Integer | getMonth (DateTime date) | |
Integer | getSeconds (DateTime date) | |
Long | getTime (DateTime date) | |
Integer | hoursBetween (DateTime start, DateTime end) | |
Date | increase (Date datetime, Number num, String interval) | |
Boolean | isLeapYear (Date date) | |
Integer | minutesBetween (DateTime start, DateTime end) | |
Integer | monthsBetween (DateTime start, DateTime end) | |
Date | now () | |
DateTime | parse (Long millis) | |
DateTime | plus (DateTime date, Long duration) | |
DateTime | plusDates (DateTime date, Integer dates) | |
DateTime | plusHours (DateTime date, Integer hours) | |
DateTime | plusMinutes (DateTime date, Integer minutes) | |
DateTime | plusMonths (DateTime date, Integer month) | |
DateTime | plusSeconds (DateTime date, Integer seconds) | |
DateTime | plusYears (DateTime date, Integer years) | |
DateTime | setDate (DateTime date, Integer day) | |
DateTime | setFullYear (DateTime date, Integer years) | |
DateTime | setHours (DateTime date, Integer hoursValue) | |
DateTime | setMinutes (DateTime date, Integer minutes) | |
DateTime | setMonth (DateTime date, Integer month) | |
DateTime | setSeconds (DateTime date, Integer seconds) | |
String | toString (Date dateTime, String formatStr) | |
Integer | yearsBetween (DateTime start, DateTime end) |
Constructor details
Top
public
Date
()
常用的日期操作
常用的日期操作
Static Properties & Enumerations Detail Top
static
public
String
DEFAULT_FORMAT
[filed]时间格式常量 = "yyyy/MM/dd hh:mm:ss"
static
public
String
DEFAULT_FORMAT1
[filed]时间格式常量 = "yyyy-MM-dd hh:mm:ss"
static
public
String
DEFAULT_FORMAT_SHOT
[filed]时间格式常量 = "yyyy/MM/dd"
static
public
String
STANDART_FORMAT
[filed]时间格式常量 = "yyyy-MM-ddThh:mm:ss.fffZ"
static
public
String
STANDART_FORMAT_SHOT
[filed]时间格式常量 = "yyyy-MM-dd"
static
public
String
UNIT_DAY
[filed]时间单位常量天 = "d"
static
public
String
UNIT_HOUR
[filed]时间单位常量小时 = "h"
static
public
String
UNIT_MINUTE
[filed]时间单位常量分钟 = "n"
static
public
String
UNIT_MONTH
[filed]时间单位常量月 = "m"
static
public
String
UNIT_QUARTER
[filed]时间单位常量度 = "q"
static
public
String
UNIT_SECOND
[filed]时间单位常量秒 = "s"
static
public
String
UNIT_WEEK
[filed]时间单位常量周 = "w"
static
public
String
UNIT_YEAR
[filed]时间单位常量 年 = "y"
Static Methods Detail Top
static
public
Number
between
(Date start, Date end)
计算两个日期相差几天,和diff很相似,返回永远是正整数
从指定时间到指定时间的天数
static
public
Date
decrease
(Date datetime, Number num, String interval)
根据日期的规则,为给定的日期减去指定的时间量
static
public
Number
diff
(Date start, Date end, String interval)
计算两个日期的差
到现在的天数
到现在的小时数
到现在的分钟数
到现在的月份
到现在的分秒数
到现在的年份
static
public
Date
fromString
(String str, String format)
按照给定的日期格式,把字符串转换成日期对象
根据本地时间返回指定日期对象的月份中的第几天(1-31)
根据本地时间返回指定日期对象的星期中的第几天(0-6)
static
public
Date
getFirstDay
(Date date)
返回月第一天
获取当前日期中的年份
获取当前日期中的小时数
static
public
Date
getLastDay
(Date date)
返回月最后天
获取当前日期中的分钟数
获取当前日期中的月份(1-12)
获取当前日期中的秒数
获取当前日期的总毫秒数
从指定时间到指定时间的小时数
static
public
Date
increase
(Date datetime, Number num, String interval)
根据日期的规则,为给定的日期添加指定的时间量
static
public
Boolean
isLeapYear
(Date date)
判断日期是否是闰年
从指定时间到指定时间的分钟数
从指定时间到指定时间的月份
static
public
Date
now
()
返回当前时间
将毫秒数转换为时间
增加/减少指定毫秒数
增加/减少指定天数
增加/减少指定小时数
增加/减少指定分钟数
增加/减少指定月份
增加/减少指定秒数
增加/减少指定年份
根据本地时间来指定一个日期对象的天数
设置当前日期的年份
设置当前日期的小时数
设置当前日期的分钟数
设置当前日期的月份
设置当前日期的秒数
static
public
String
toString
(Date dateTime, String formatStr)
按照给定的日期格式,把日期对象转换成字符串
从指定时间到指定时间的年份