Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
yangxiujun
/
paidan_demo
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 9121a80b
authored
Jul 21, 2023
by
wangli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增字符串转换为localtime
1 parent
b867c9b6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletions
project-order/src/main/java/com/dituhui/pea/order/common/TimeUtils.java
project-order/src/main/java/com/dituhui/pea/order/common/TimeUtils.java
View file @
9121a80
...
...
@@ -3,13 +3,14 @@ package com.dituhui.pea.order.common;
import
java.sql.Timestamp
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.LocalTime
;
import
java.time.format.DateTimeFormatter
;
public
class
TimeUtils
{
public
static
final
String
DATE_TIME_FORMAT
=
"yyyy-MM-dd HH:mm:ss"
;
public
static
final
String
DATE_NO_GAP_FORMAT
=
"yyyyMMdd"
;
public
static
final
String
DATE_GAP_FORMAT
=
"yyyy-MM-dd"
;
public
static
final
String
TIME_HH_MM_FORMAT
=
"HHmm"
;
public
static
final
String
TIME_HH_MM_FORMAT
=
"HH
:
mm"
;
public
static
final
String
IsoTimestamp2DateTime
(
Timestamp
timestamp
)
{
// Timestamp转换为日期时间字符串
...
...
@@ -51,6 +52,10 @@ public class TimeUtils {
return
localDate
.
format
(
DateTimeFormatter
.
ofPattern
(
DATE_GAP_FORMAT
));
}
public
static
final
LocalTime
time2LocalTime
(
String
s
)
{
return
LocalTime
.
parse
(
s
,
DateTimeFormatter
.
ofPattern
(
TIME_HH_MM_FORMAT
));
}
public
static
final
LocalDate
addDays
(
LocalDate
date
,
long
days
)
{
return
date
.
plusDays
(
days
);
}
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment