Click here to watch on Youtube :
https://www.youtube.com/watch?v=eNeCn0rrvvc&list=UUhwKlOVR041tngjerWxVccw
Click the below Image to Enlarge
Java 8 MonthDay Class Introduction | Java 8 Date and Time | Java Date and Time |
import java.time.MonthDay;
public class MonthDayDemo
{
public static void main(String[] args)
{
/*
* Returns:
*
* the current month-day using the system clock and
* default time-zone, not null
*/
MonthDay currentMonthDay = MonthDay.now();
System.out.println(currentMonthDay);
/*
* Parameters:
*
* text - the text to parse such as "--12-03", not null
*
* Returns:
*
* the parsed month-day, not null
*/
MonthDay monthDay = MonthDay.parse("--03-30");
System.out.println(monthDay);
}
}
public class MonthDayDemo
{
public static void main(String[] args)
{
/*
* Returns:
*
* the current month-day using the system clock and
* default time-zone, not null
*/
MonthDay currentMonthDay = MonthDay.now();
System.out.println(currentMonthDay);
/*
* Parameters:
*
* text - the text to parse such as "--12-03", not null
*
* Returns:
*
* the parsed month-day, not null
*/
MonthDay monthDay = MonthDay.parse("--03-30");
System.out.println(monthDay);
}
}
Output
--01-18
--03-30
--03-30
Refer:
https://docs.oracle.com/javase/8/docs/api/index.html?java/time/MonthDay.html
Click the below link to download the code:
https://sites.google.com/site/ramj2eev1/home/javabasics/MonthDayDemo_Intro.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/MonthDayDemo_Intro
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/8fa516d67356209c67bf6743dfb7e718c4c9e5f6/BasicJava/MonthDayDemo_Intro/?at=master
See also:
No comments:
Post a Comment