Click here to watch on Youtube :
https://www.youtube.com/watch?v=2zrIai4MHdk&list=UUhwKlOVR041tngjerWxVccw
OffsetDateTimeDemo.java
Output
Click the below link to download the code:
https://sites.google.com/site/ramj2eev1/home/javabasics/OffsetDateTimeDemo_ofInstant.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/OffsetDateTimeDemo_ofInstant
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/572947048c5892379e75d8e421fa231c20e2d3bc/BasicJava/OffsetDateTimeDemo_ofInstant/?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
https://www.youtube.com/watch?v=2zrIai4MHdk&list=UUhwKlOVR041tngjerWxVccw
OffsetDateTimeDemo.java
import java.time.Instant;
import java.time.OffsetDateTime;
import java.time.ZoneId;
public class OffsetDateTimeDemo
{
public static void main(String[] args)
{
Instant instant = Instant.now();
ZoneId zoneId = ZoneId.systemDefault();
/*
* Parameters:
*
* instant - the instant to create the date-time from, not
* null
*
* zone - the time-zone, which may be an offset, not null
*
* Returns:
*
* the offset date-time, not null
*/
OffsetDateTime offsetDateTime = OffsetDateTime.ofInstant(instant,
zoneId);
System.out.println(offsetDateTime);
}
}
import java.time.OffsetDateTime;
import java.time.ZoneId;
public class OffsetDateTimeDemo
{
public static void main(String[] args)
{
Instant instant = Instant.now();
ZoneId zoneId = ZoneId.systemDefault();
/*
* Parameters:
*
* instant - the instant to create the date-time from, not
* null
*
* zone - the time-zone, which may be an offset, not null
*
* Returns:
*
* the offset date-time, not null
*/
OffsetDateTime offsetDateTime = OffsetDateTime.ofInstant(instant,
zoneId);
System.out.println(offsetDateTime);
}
}
Output
2018-01-29T09:57:07.220+05:30
Click the below link to download the code:
https://sites.google.com/site/ramj2eev1/home/javabasics/OffsetDateTimeDemo_ofInstant.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/OffsetDateTimeDemo_ofInstant
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/572947048c5892379e75d8e421fa231c20e2d3bc/BasicJava/OffsetDateTimeDemo_ofInstant/?at=master
See also:
No comments:
Post a Comment