public class DateTimeKit extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
dateFormat |
static String |
timeFormat |
| 构造器和说明 |
|---|
DateTimeKit() |
| 限定符和类型 | 方法和说明 |
|---|---|
static LocalDate |
firstDayOfWeek(LocalDate date)
获取指定时间所在周的第一天的日期
|
static String |
format(Date date,
String pattern)
格式化
|
static String |
format(String date,
String parsePattern,
String returnPattern)
格式化
|
static LocalDate |
getCurrernWeekEnd()
获取本周最后一天日期
|
static LocalDate |
getCurrernWeekStart()
获取本周第一天日期
|
static Date |
getDate()
获取当前时间
|
static int |
getDateDaySpace(Date start,
Date end)
返回两个日期之间隔了多少天
|
static int |
getDateHourSpace(Date start,
Date end)
返回两个日期之间隔了多少小时
|
static long |
getDateTime()
获取当前时间的时间戳
|
static LocalDate |
getLastWeekEnd()
获取上周最后一天日期
|
static LocalDate |
getLastWeekStart()
获取上周第一天日期
|
static Timestamp |
getSqlTimestamp(Date date)
主要是给jfinal使用,数据库只认java.sql
|
static Timestamp |
getSqlTimestamp(long time)
主要是给jfinal使用,数据库只认java.sql
|
static boolean |
isBetween(LocalDate now,
LocalDate start,
LocalDate end)
指定时间是否在两个时间之间
|
static LocalDate |
lastDayOfWeek(LocalDate date)
获取指定时间所在州的最后一天的日期
|
static Date |
parse(String dateStr)
解析
|
static Date |
parse(String date,
String pattern)
解析
|
static void |
setDateFromat(String dateFormat) |
static void |
setTimeFromat(String timeFormat) |
public static void setDateFromat(String dateFormat)
public static void setTimeFromat(String timeFormat)
public static String format(String date, String parsePattern, String returnPattern)
date - parsePattern - returnPattern - public static LocalDate getLastWeekStart()
public static LocalDate getLastWeekEnd()
public static LocalDate getCurrernWeekStart()
public static LocalDate getCurrernWeekEnd()
public static LocalDate lastDayOfWeek(LocalDate date)
date - public static LocalDate firstDayOfWeek(LocalDate date)
date - public static boolean isBetween(LocalDate now, LocalDate start, LocalDate end)
now - 当前时间start - 开始时间end - 结束时间public static Date getDate()
public static int getDateDaySpace(Date start, Date end)
date1 - end - public static int getDateHourSpace(Date start, Date end)
date1 - end - public static long getDateTime()
public static Timestamp getSqlTimestamp(Date date)
date - public static Timestamp getSqlTimestamp(long time)
time - Copyright © 2015. All rights reserved.