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
32bc9dae
Commit
32bc9dae
authored
Sep 30, 2022
by
Patryk Czarnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lista kolejnych dni
parent
b5f1cbef
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
DateTimeController.java
...ng/src/main/java/com/example/demo/DateTimeController.java
+11
-0
show_time6.html
PC29-Spring/src/main/resources/templates/show_time6.html
+6
-0
No files found.
PC29-Spring/src/main/java/com/example/demo/DateTimeController.java
View file @
32bc9dae
package
com
.
example
.
demo
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.LocalTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Locale
;
import
org.springframework.stereotype.Controller
;
...
...
@@ -70,6 +73,14 @@ public class DateTimeController {
public
String
time6
(
Model
model
)
{
LocalDateTime
dt
=
LocalDateTime
.
now
();
model
.
addAttribute
(
"dt"
,
dt
);
List
<
LocalDate
>
dates
=
new
ArrayList
<>();
LocalDate
date
=
dt
.
toLocalDate
();
for
(
int
i
=
0
;
i
<=
5
;
i
++)
{
dates
.
add
(
date
.
plusWeeks
(
i
));
}
model
.
addAttribute
(
"futureWeeks"
,
dates
);
return
"show_time6.html"
;
}
...
...
PC29-Spring/src/main/resources/templates/show_time6.html
View file @
32bc9dae
...
...
@@ -44,5 +44,11 @@
<li>
czas:
<strong
th:text=
"${dt.toLocalTime()}"
>
10:44:22
</strong></li>
</ul>
<h3>
Odczyt elementów listy
</h3>
<p>
Ten sam dzień w kolejnych tygodniach:
</p>
<ol
start=
"0"
>
<li
th:each=
"date : ${futureWeeks}"
th:text=
"${date}"
>
2022-08-01
</li>
</ol>
</body>
</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