Click here to watch on Youtube :
https://www.youtube.com/watch?v=T7tJju_bLZg&index=10&list=UUhwKlOVR041tngjerWxVccw
OffsetDateTimeDemo.java
Output
Click the below link to download the code:
https://sites.google.com/site/ramj2eev1/home/javabasics/OffsetDateTimeDemo_get_temporalfield.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/OffsetDateTimeDemo_get_temporalfield
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/572947048c5892379e75d8e421fa231c20e2d3bc/BasicJava/OffsetDateTimeDemo_get_temporalfield/?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=T7tJju_bLZg&index=10&list=UUhwKlOVR041tngjerWxVccw
OffsetDateTimeDemo.java
import java.time.OffsetDateTime;
import java.time.temporal.ChronoField;
public class OffsetDateTimeDemo
{
public static void main(String[] args)
{
OffsetDateTime offsetDateTime = OffsetDateTime.now();
System.out.println(offsetDateTime);
/*
* Parameters:
*
* field - the field to get, not null
*
* Returns:
*
* the value for the field
*/
int dayOfMonth = offsetDateTime.get(ChronoField.DAY_OF_MONTH);
System.out.println("dayOfMonth = " + dayOfMonth);
int monthOfYear = offsetDateTime.get(ChronoField.MONTH_OF_YEAR);
System.out.println("monthOfYear = " + monthOfYear);
}
}
import java.time.temporal.ChronoField;
public class OffsetDateTimeDemo
{
public static void main(String[] args)
{
OffsetDateTime offsetDateTime = OffsetDateTime.now();
System.out.println(offsetDateTime);
/*
* Parameters:
*
* field - the field to get, not null
*
* Returns:
*
* the value for the field
*/
int dayOfMonth = offsetDateTime.get(ChronoField.DAY_OF_MONTH);
System.out.println("dayOfMonth = " + dayOfMonth);
int monthOfYear = offsetDateTime.get(ChronoField.MONTH_OF_YEAR);
System.out.println("monthOfYear = " + monthOfYear);
}
}
Output
2018-01-28T08:35:20.954+05:30
dayOfMonth = 28
monthOfYear = 1
dayOfMonth = 28
monthOfYear = 1
Click the below link to download the code:
https://sites.google.com/site/ramj2eev1/home/javabasics/OffsetDateTimeDemo_get_temporalfield.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/OffsetDateTimeDemo_get_temporalfield
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/572947048c5892379e75d8e421fa231c20e2d3bc/BasicJava/OffsetDateTimeDemo_get_temporalfield/?at=master
See also:
No comments:
Post a Comment