Click here to watch on Youtube:
https://www.youtube.com/watch?v=b9W0v9Kdl9Q&list=UUhwKlOVR041tngjerWxVccw
ZoneOffsetDemo1.java
Output
ZoneOffsetDemo2.java
Output
Click the below link to download the code:
https://sites.google.com/site/ramj2eev1/home/javabasics/ZoneOffsetDemo_id_totalsec.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/ZoneOffsetDemo_id_totalsec
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/dc7c5f1cf2584c5bc7f3eb33e62ff414965c0d6f/BasicJava/ZoneOffsetDemo_id_totalsec/?at=master
See also:
All JavaEE Videos Playlist
All JavaEE Videos
All JAVA EE Links
Servlets Tutorial
All Design Patterns Links
JDBC Tutorial
Java Collection Framework Tutorial
JAVA Tutorial
Kids Tutorial
Cooking Tutorial
https://www.youtube.com/watch?v=b9W0v9Kdl9Q&list=UUhwKlOVR041tngjerWxVccw
ZoneOffsetDemo1.java
import java.time.ZoneOffset;
public class ZoneOffsetDemo1
{
public static void main(String[] args)
{
ZoneOffset zoneOffset = ZoneOffset.UTC;
System.out.println("zoneOffset = "+zoneOffset);
/*
* Returns:the zone offset ID, not null
*/
String id = zoneOffset.getId();
System.out.println("id = "+id);
}
}
public class ZoneOffsetDemo1
{
public static void main(String[] args)
{
ZoneOffset zoneOffset = ZoneOffset.UTC;
System.out.println("zoneOffset = "+zoneOffset);
/*
* Returns:the zone offset ID, not null
*/
String id = zoneOffset.getId();
System.out.println("id = "+id);
}
}
Output
zoneOffset = Z
id = Z
id = Z
ZoneOffsetDemo2.java
import java.time.ZoneOffset;
public class ZoneOffsetDemo2
{
public static void main(String[] args)
{
ZoneOffset zoneOffset = ZoneOffset.of("+01:00");
System.out.println("zoneOffset = "+zoneOffset);
/*
* Returns:the total zone offset amount in seconds
*/
int totalSeconds = zoneOffset.getTotalSeconds();
System.out.println("totalSeconds = "+totalSeconds);
}
}
public class ZoneOffsetDemo2
{
public static void main(String[] args)
{
ZoneOffset zoneOffset = ZoneOffset.of("+01:00");
System.out.println("zoneOffset = "+zoneOffset);
/*
* Returns:the total zone offset amount in seconds
*/
int totalSeconds = zoneOffset.getTotalSeconds();
System.out.println("totalSeconds = "+totalSeconds);
}
}
Output
zoneOffset = +01:00
totalSeconds = 3600
totalSeconds = 3600
Click the below link to download the code:
https://sites.google.com/site/ramj2eev1/home/javabasics/ZoneOffsetDemo_id_totalsec.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/ZoneOffsetDemo_id_totalsec
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/dc7c5f1cf2584c5bc7f3eb33e62ff414965c0d6f/BasicJava/ZoneOffsetDemo_id_totalsec/?at=master
See also:
No comments:
Post a Comment