Click here to watch on Youtube :
https://www.youtube.com/watch?v=eU462WZyGCI&list=UUhwKlOVR041tngjerWxVccw
LocalDateDemo.java
Output
Click the below link to download the code:
https://sites.google.com/site/ramj2eev1/home/javabasics/LocalDateDemo_get.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/LocalDateDemo_get
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/f50b0477cba623e7ace08d1d7966409dcc9e7b40/BasicJava/LocalDateDemo_get/?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=eU462WZyGCI&list=UUhwKlOVR041tngjerWxVccw
LocalDateDemo.java
import java.time.LocalDate;
import java.time.temporal.ChronoField;
public class LocalDateDemo
{
public static void main(String[] args)
{
LocalDate date = LocalDate.parse("2017-11-23");
System.out.println(date);
/*
* Parameters:
*
* field - the field to get, not null
*
* Returns:
*
* the value for the field
*/
int year = date.get(ChronoField.YEAR);
System.out.println("year = "+year);
int month = date.get(ChronoField.MONTH_OF_YEAR);
System.out.println("month of year = "+month);
int dayOfTheMonth = date.get(ChronoField.DAY_OF_MONTH);
System.out.println("dayOfTheMonth = "+dayOfTheMonth);
}
}
import java.time.temporal.ChronoField;
public class LocalDateDemo
{
public static void main(String[] args)
{
LocalDate date = LocalDate.parse("2017-11-23");
System.out.println(date);
/*
* Parameters:
*
* field - the field to get, not null
*
* Returns:
*
* the value for the field
*/
int year = date.get(ChronoField.YEAR);
System.out.println("year = "+year);
int month = date.get(ChronoField.MONTH_OF_YEAR);
System.out.println("month of year = "+month);
int dayOfTheMonth = date.get(ChronoField.DAY_OF_MONTH);
System.out.println("dayOfTheMonth = "+dayOfTheMonth);
}
}
Output
2017-11-23
year = 2017
month of year = 11
dayOfTheMonth = 23
year = 2017
month of year = 11
dayOfTheMonth = 23
Click the below link to download the code:
https://sites.google.com/site/ramj2eev1/home/javabasics/LocalDateDemo_get.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/LocalDateDemo_get
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/f50b0477cba623e7ace08d1d7966409dcc9e7b40/BasicJava/LocalDateDemo_get/?at=master
See also:
No comments:
Post a Comment