Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7e517e3

Browse files
authored
Merge pull request#31 from coderolls/blogpost/how-to-get-current-date-time-in-java
Add GitHub Gist links
2 parents3571f69 +b8e224a commit7e517e3

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

‎_posts/java-time/2021-05-15-get-current-date-time-in-java.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ Sat May 15 12:21:39 IST 2021
6565
15/05/2021 12:21:39
6666
15/05/2021 12:21:39
6767
```
68+
Check above code as[GitHub Gist](https://gist.github.com/gauravkukade/c0abb86106b161cd9b3d12de37e34cb3)
6869

6970
##2. Java Calendar API (`java.util.Calendar`) (Legacy)
7071

@@ -107,6 +108,8 @@ Sat May 15 12:50:17 IST 2021
107108
15/05/2021 12:50:17
108109
```
109110

111+
Check above code as[GitHub Gist](https://gist.github.com/gauravkukade/b29079c6b840d9c894c836468d9326dd)
112+
110113
##3. LocalDate (`java.time.LocalDate`)
111114

112115

@@ -144,6 +147,7 @@ Output:
144147
2021-05-15
145148
2021/05/15
146149
```
150+
Check above code as[GitHub Gist](https://gist.github.com/gauravkukade/4a756785c65e94fa645c1a4faa65edb4)
147151

148152
##4. LocalTime (`java.time.LocalTime`)
149153

@@ -181,6 +185,7 @@ Output:
181185
13:11:46.140359217
182186
13:11:46
183187
```
188+
Check above code as[GitHub Gist](https://gist.github.com/gauravkukade/8ca11fd8b4652f33932b66a518c5775d)
184189

185190
##5. LocalDateTime (`java.time.LocalDateTime`)
186191

@@ -220,6 +225,7 @@ Output:
220225
2021-05-15T13:20:13.329481722
221226
15/05/2021 13:20:13
222227
```
228+
Check above code as[GitHub Gist](https://gist.github.com/gauravkukade/ef36191b7cca3069631ab45918624c1c)
223229

224230
##6. ZonedDateTime (`java.time.ZonedDateTime`)
225231

@@ -287,6 +293,8 @@ Asia/Kolkata
287293
2021/05/15 10:15:55
288294
+02:00
289295
```
296+
Check above code as[GitHub Gist](https://gist.github.com/gauravkukade/1ef796c53091ddb2a658f3e7dda22366)
297+
290298
##7. Instant (`java.time.Instant`)
291299

292300
We can use`java.time.Instant` to get epoch timestamps in seconds and milliseconds.
@@ -332,6 +340,7 @@ Output:
332340
1621073505
333341
15/05/2021 15:41:45
334342
```
343+
Check above code as[GitHub Gist](https://gist.github.com/gauravkukade/f490a87ced1aa63c076bbe6bd7860a2c)
335344

336345
##Conclusion
337346

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp