Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
java_dzienna_15_09
Overview
Overview
Details
Activity
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
Patryk Czarnik
java_dzienna_15_09
Commits
24c20f31
Commit
24c20f31
authored
Sep 30, 2022
by
Patryk Czarnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
show_time5
parent
b02f784f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
2 deletions
+15
-2
DateTimeController.java
...ng/src/main/java/com/example/demo/DateTimeController.java
+4
-2
show_time5.html
PC29-Spring/src/main/resources/templates/show_time5.html
+11
-0
No files found.
PC29-Spring/src/main/java/com/example/demo/DateTimeController.java
View file @
24c20f31
...
@@ -6,6 +6,7 @@ import java.time.format.DateTimeFormatter;
...
@@ -6,6 +6,7 @@ import java.time.format.DateTimeFormatter;
import
java.util.Locale
;
import
java.util.Locale
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.ResponseBody
;
...
@@ -49,9 +50,10 @@ public class DateTimeController {
...
@@ -49,9 +50,10 @@ public class DateTimeController {
}
}
@RequestMapping
(
"/time5"
)
@RequestMapping
(
"/time5"
)
public
String
time5
()
{
public
String
time5
(
Model
model
)
{
LocalDateTime
dt
=
LocalDateTime
.
now
();
LocalDateTime
dt
=
LocalDateTime
.
now
();
model
.
addAttribute
(
"czas"
,
dt
);
model
.
addAttribute
(
"sformatowany_czas"
,
dt
.
format
(
FORMAT_DATY
));
return
"show_time5.html"
;
return
"show_time5.html"
;
}
}
...
...
PC29-Spring/src/main/resources/templates/show_time5.html
View file @
24c20f31
...
@@ -8,6 +8,17 @@
...
@@ -8,6 +8,17 @@
<h1>
Która godzina 5
</h1>
<h1>
Która godzina 5
</h1>
<p>
Zaraz powiem, która jest godzina...
</p>
<p>
Zaraz powiem, która jest godzina...
</p>
<p>
Otóż teraz jest: [[${czas}]]
</p>
<h3>
Wybrane pola daty i czasu
</h3>
<ul>
<li>
rok: [[${czas.year}]]
</li>
<li>
dzień roku: [[${czas.dayOfYear}]]
</li>
<li>
sekunda: [[${czas.second}]]
</li>
<li>
cała data: [[${czas.toLocalDate()}]]
</li>
</ul>
<h3>
Sformatowany czas:
</h3>
<p>
[[${sformatowany_czas}]]
</p>
</body>
</body>
</html>
</html>
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