Click here to watch on Youtube:
https://www.youtube.com/watch?v=pEsWisSl5NE&list=UUhwKlOVR041tngjerWxVccw
MonthDemo.java
Output
Click the below link to download the code:
https://sites.google.com/site/ramj2eev2/java_basics/MonthDemo_adjustInto.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava_2018/MonthDemo_adjustInto
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/8781cb2c398cca3734b090d3a80e4b0023df3f71/BasicJava_2018/MonthDemo_adjustInto/?at=master
See also:
All JavaEE Videos Playlist
All JavaEE Videos
All JAVA EE Links
Spring Tutorial
Servlets Tutorial
All Design Patterns Links
JDBC Tutorial
Java Collection Framework Tutorial
JAVA Tutorial
Kids Tutorial
Cooking Tutorial
https://www.youtube.com/watch?v=pEsWisSl5NE&list=UUhwKlOVR041tngjerWxVccw
MonthDemo.java
import java.time.Month;
import java.time.ZonedDateTime;
/**
* Temporal java.time.Month.adjustInto(Temporal temporal)
*
* Adjusts the specified temporal object to have this month-of-year.
*
* Parameters:
*
* temporal - the target object to be adjusted, not null
*
* Returns:
*
* the adjusted object, not null
*
*/
public class MonthDemo
{
public static void main(String[] args)
{
ZonedDateTime zonedDateTime = ZonedDateTime.now();
System.out.println("zonedDateTime = " + zonedDateTime);
Month month = Month.of(2);
System.out.println("month = " + month);
zonedDateTime = (ZonedDateTime) month.adjustInto(zonedDateTime);
System.out.println(zonedDateTime);
}
}
import java.time.ZonedDateTime;
/**
* Temporal java.time.Month.adjustInto(Temporal temporal)
*
* Adjusts the specified temporal object to have this month-of-year.
*
* Parameters:
*
* temporal - the target object to be adjusted, not null
*
* Returns:
*
* the adjusted object, not null
*
*/
public class MonthDemo
{
public static void main(String[] args)
{
ZonedDateTime zonedDateTime = ZonedDateTime.now();
System.out.println("zonedDateTime = " + zonedDateTime);
Month month = Month.of(2);
System.out.println("month = " + month);
zonedDateTime = (ZonedDateTime) month.adjustInto(zonedDateTime);
System.out.println(zonedDateTime);
}
}
Output
zonedDateTime = 2018-04-18T10:11:54.598+05:30[Asia/Calcutta]
month = FEBRUARY
2018-02-18T10:11:54.598+05:30[Asia/Calcutta]
month = FEBRUARY
2018-02-18T10:11:54.598+05:30[Asia/Calcutta]
Click the below link to download the code:
https://sites.google.com/site/ramj2eev2/java_basics/MonthDemo_adjustInto.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava_2018/MonthDemo_adjustInto
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/8781cb2c398cca3734b090d3a80e4b0023df3f71/BasicJava_2018/MonthDemo_adjustInto/?at=master
See also:
No comments:
Post a Comment