Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
Y
yzg-util
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
YZG
yzg-util
Commits
e4ad01d0
Commit
e4ad01d0
authored
Dec 12, 2023
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改日志打印功能,打印更加详细的日志
parent
a4537ca6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletion
+10
-1
DateHelper.java
...src/main/java/com/yanzuoguang/util/helper/DateHelper.java
+1
-1
TestDateHelper.java
yzg-util-base/src/test/java/helper/TestDateHelper.java
+9
-0
No files found.
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/DateHelper.java
View file @
e4ad01d0
...
...
@@ -276,7 +276,7 @@ public class DateHelper {
public
static
int
getMonth
(
Date
date
)
{
Calendar
c
=
Calendar
.
getInstance
();
c
.
setTime
(
date
);
return
c
.
get
(
Calendar
.
MONTH
);
return
c
.
get
(
Calendar
.
MONTH
)
+
1
;
}
/**
...
...
yzg-util-base/src/test/java/helper/TestDateHelper.java
View file @
e4ad01d0
...
...
@@ -72,4 +72,13 @@ public class TestDateHelper {
System
.
out
.
println
(
json
);
Assert
.
assertEquals
(
"[{\"from\":\"2023-07-01 10:00:00\",\"to\":\"2023-07-01 19:00:00\"}]"
,
json
);
}
@Test
public
void
testDayMonth
()
{
Date
dt
=
DateHelper
.
getDateTime
(
"2023-12-12 15:59:59"
);
Assert
.
assertEquals
(
2023
,
DateHelper
.
getYear
(
dt
));
Assert
.
assertEquals
(
12
,
DateHelper
.
getMonth
(
dt
));
Assert
.
assertEquals
(
12
,
DateHelper
.
getDay
(
dt
));
Assert
.
assertEquals
(
15
,
DateHelper
.
getHour
(
dt
));
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment