Click here to watch on Youtube :
https://www.youtube.com/watch?v=6jS3TBOjAKg&list=UUhwKlOVR041tngjerWxVccw
LocalDateTimeDemo.java
Output
Click the below link to download the code:
https://sites.google.com/site/ramj2eev1/home/javabasics/LocalDateTimeDemo_atOffset.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/LocalDateTimeDemo_atOffset
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/2732bd5046563d647669928b143687e5dbf4d99f/BasicJava/LocalDateTimeDemo_atOffset/?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=6jS3TBOjAKg&list=UUhwKlOVR041tngjerWxVccw
LocalDateTimeDemo.java
import java.time.LocalDateTime;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
public class LocalDateTimeDemo
{
public static void main(String[] args)
{
LocalDateTime localDateTime = LocalDateTime
.parse("2017-02-03T12:30:30");
System.out.println("localDateTime = "+localDateTime);
ZoneOffset zoneOffset = ZoneOffset.ofHours(5);
System.out.println("zoneOffset = "+zoneOffset);
/*
* Parameters:
*
* offset - the offset to combine with, not null
*
* Returns:
*
* the offset date-time formed from this date-time and the
* specified offset, not null
*/
OffsetDateTime offsetDateTime = localDateTime.atOffset(zoneOffset);
System.out.println("offsetDateTime = "+offsetDateTime);
}
}
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
public class LocalDateTimeDemo
{
public static void main(String[] args)
{
LocalDateTime localDateTime = LocalDateTime
.parse("2017-02-03T12:30:30");
System.out.println("localDateTime = "+localDateTime);
ZoneOffset zoneOffset = ZoneOffset.ofHours(5);
System.out.println("zoneOffset = "+zoneOffset);
/*
* Parameters:
*
* offset - the offset to combine with, not null
*
* Returns:
*
* the offset date-time formed from this date-time and the
* specified offset, not null
*/
OffsetDateTime offsetDateTime = localDateTime.atOffset(zoneOffset);
System.out.println("offsetDateTime = "+offsetDateTime);
}
}
Output
localDateTime = 2017-02-03T12:30:30
zoneOffset = +05:00
offsetDateTime = 2017-02-03T12:30:30+05:00
zoneOffset = +05:00
offsetDateTime = 2017-02-03T12:30:30+05:00
Click the below link to download the code:
https://sites.google.com/site/ramj2eev1/home/javabasics/LocalDateTimeDemo_atOffset.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/LocalDateTimeDemo_atOffset
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/2732bd5046563d647669928b143687e5dbf4d99f/BasicJava/LocalDateTimeDemo_atOffset/?at=master
See also:
No comments:
Post a Comment