Skip to content

Commit af649f5

Browse files
committed
Add zoneddatetime example
1 parent d4d694f commit af649f5

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ Link to the PlayList: https://www.youtube.com/watch?v=uhPLWdvrF9g&list=PLB1G
4646
39. [How To Calculate Duration Between Two Times In Java?](https://youtu.be/jx2rgFkgXbg)
4747
40. [Calculate Difference Between Two Dates Using Java 8 ChronoUnit](https://youtu.be/m8qP0ZyhMYo)
4848
41. [Instant Class In Java 8 Date And Time API](https://youtu.be/7k-YYH4yUxQ)
49+
42. [ZonedDateTime Class In Java 8 Date And Time API](https://youtu.be/OgZYxNiwm2Y)
4950

5051

5152
## [Chick here to Subscribe our YouTube Channel](https://www.youtube.com/channel/UCl31HHUdQbSHOQfc9L-wo3w?sub_confirmation=1)
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package com.coderolls.java.date_and_time.zoneddatetime;
2+
3+
import java.time.ZoneId;
4+
import java.time.ZonedDateTime;
5+
6+
public class ZonedDateTimeExample {
7+
8+
public static void main(String[] args) {
9+
10+
11+
ZoneId id = ZoneId.systemDefault();
12+
System.out.println(id);
13+
14+
ZonedDateTime zdt = ZonedDateTime.now(id);
15+
System.out.println("Current system default zoned date time: ");
16+
System.out.println(zdt);
17+
18+
ZoneId id2 = ZoneId.of("America/Los_Angeles");
19+
ZonedDateTime zdt2 = ZonedDateTime.now(id2);
20+
21+
System.out.println("\nAmerica/Los_Angeles zoned date time: ");
22+
System.out.println(zdt2);
23+
24+
25+
26+
27+
}
28+
29+
}

target/classes/META-INF/maven/com.coderolls.java/SampleProject/pom.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#Generated by Maven Integration for Eclipse
2-
#Thu Feb 17 09:39:27 IST 2022
2+
#Tue Mar 15 15:42:58 IST 2022
33
m2e.projectLocation=/home/gaurav/coderolls/coderolls-videos/java-8-features-full-course-examples
44
m2e.projectName=java-8-features-full-course-examples
55
groupId=com.coderolls.java

0 commit comments

Comments
 (0)