Commit 25a303e7 by Patryk Czarnik

Bardzo prosty szablon do wyświetlania czasu

parent b31b0eb0
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
/RemoteSystemsTempFiles/ /RemoteSystemsTempFiles/
/Servers/ /Servers/
/local/ /local/
/.sonarlint/
# w razie gdyby ktos zaimportowal cale repo jako projekt # w razie gdyby ktos zaimportowal cale repo jako projekt
/.project /.project
......
...@@ -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;
...@@ -53,4 +54,11 @@ public class TimeController { ...@@ -53,4 +54,11 @@ public class TimeController {
dt.toLocalTime(), dt.toLocalDate(), dt.format(FORMAT_DATY)); dt.toLocalTime(), dt.toLocalDate(), dt.format(FORMAT_DATY));
} }
@RequestMapping("/time5")
public String time5(Model model) {
LocalDateTime dateTime = LocalDateTime.now();
model.addAttribute("dt", dateTime);
return "wyswietl_czas5.html";
}
} }
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Która godzina</title>
</head>
<body>
<p>Data i czas: [[${dt}]].</p>
<p>Dzisiaj mamy [[${dt.dayOfYear}]] dzień roku [[${dt.year}]].</p>
</body>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment