Friday 2 February 2018

How to use from method of MonthDay Class | Java 8 Date and Time


Click here to watch on Youtube : 
https://www.youtube.com/watch?v=fY19FMUy7_8&list=UUhwKlOVR041tngjerWxVccw

MonthDayDemo.java

import java.time.MonthDay;
import java.time.ZonedDateTime;

public class MonthDayDemo
{

    public static void main(String[] args)
    {
       
        ZonedDateTime zonedDateTime = ZonedDateTime.now();
        System.out.println(zonedDateTime);
        /*
         * Parameters:
         *
         * temporal - the temporal object to convert, not null
         *
         * Returns:the month-day, not null
         */

        MonthDay monthDay = MonthDay.from(zonedDateTime);
        System.out.println(monthDay);
    }

}

Output

2018-01-19T09:18:45.949+05:30[Asia/Calcutta]
--01-19

Click the below link to download the code:
https://sites.google.com/site/ramj2eev1/home/javabasics/MonthDayDemo_from.zip?attredirects=0&d=1

Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/MonthDayDemo_from

Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/d57185a7bf9e23294d2a9e7b3cf655cc136de202/BasicJava/MonthDayDemo_from/?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
  • No comments:

    Post a Comment