Click here to watch on Youtube :
https://www.youtube.com/watch?v=R9g31nESFG0&list=UUhwKlOVR041tngjerWxVccw
ZoneDateTimeDemo.java
Output
Click the below link to download the code:
https://sites.google.com/site/ramj2eev1/home/javabasics/ZoneDateTimeDemo_get_field.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/ZoneDateTimeDemo_get_field
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/914905cc2357de2bddb749208190c8f0bf0f9978/BasicJava/ZoneDateTimeDemo_get_field/?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=R9g31nESFG0&list=UUhwKlOVR041tngjerWxVccw
ZoneDateTimeDemo.java
import java.time.ZonedDateTime;
import java.time.temporal.ChronoField;
public class ZoneDateTimeDemo
{
public static void main(String[] args)
{
ZonedDateTime zonedDateTime = ZonedDateTime.now();
System.out.println(zonedDateTime);
/*
* Parameters:
*
* field - the field to get, not null
*
* Returns:
*
* the value for the field
*/
int dayOfMonth = zonedDateTime.get(ChronoField.DAY_OF_MONTH);
System.out.println("dayOfMonth = " + dayOfMonth);
int monthOfYear = zonedDateTime.get(ChronoField.MONTH_OF_YEAR);
System.out.println("monthOfYear = " + monthOfYear);
}
}
import java.time.temporal.ChronoField;
public class ZoneDateTimeDemo
{
public static void main(String[] args)
{
ZonedDateTime zonedDateTime = ZonedDateTime.now();
System.out.println(zonedDateTime);
/*
* Parameters:
*
* field - the field to get, not null
*
* Returns:
*
* the value for the field
*/
int dayOfMonth = zonedDateTime.get(ChronoField.DAY_OF_MONTH);
System.out.println("dayOfMonth = " + dayOfMonth);
int monthOfYear = zonedDateTime.get(ChronoField.MONTH_OF_YEAR);
System.out.println("monthOfYear = " + monthOfYear);
}
}
Output
2018-02-08T09:42:24.807+05:30[Asia/Calcutta]
dayOfMonth = 8
monthOfYear = 2
dayOfMonth = 8
monthOfYear = 2
Click the below link to download the code:
https://sites.google.com/site/ramj2eev1/home/javabasics/ZoneDateTimeDemo_get_field.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/ZoneDateTimeDemo_get_field
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/914905cc2357de2bddb749208190c8f0bf0f9978/BasicJava/ZoneDateTimeDemo_get_field/?at=master
See also:
No comments:
Post a Comment