Click here to watch on Youtube :
https://www.youtube.com/watch?v=X7Nuvk3uH6o&list=UUhwKlOVR041tngjerWxVccw
LocalDateTimeDemo.java
Output
Click the below link to download the code:
https://sites.google.com/site/ramj2eev1/home/javabasics/LocalDateTimeDemo_truncatedto.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/LocalDateTimeDemo_truncatedto
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/2732bd5046563d647669928b143687e5dbf4d99f/BasicJava/LocalDateTimeDemo_truncatedto/?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=X7Nuvk3uH6o&list=UUhwKlOVR041tngjerWxVccw
LocalDateTimeDemo.java
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
public class LocalDateTimeDemo
{
public static void main(String[] args)
{
LocalDateTime localDateTime1 = LocalDateTime.now();
System.out.println(localDateTime1);
/*
* Parameters:
*
* unit - the unit to truncate to, not null
*
* Returns:
*
* a LocalDateTime based on this date-time with the
* time truncated, not null
*/
LocalDateTime localDateTime2 = localDateTime1
.truncatedTo(ChronoUnit.DAYS);
System.out.println(localDateTime2);
}
}
import java.time.temporal.ChronoUnit;
public class LocalDateTimeDemo
{
public static void main(String[] args)
{
LocalDateTime localDateTime1 = LocalDateTime.now();
System.out.println(localDateTime1);
/*
* Parameters:
*
* unit - the unit to truncate to, not null
*
* Returns:
*
* a LocalDateTime based on this date-time with the
* time truncated, not null
*/
LocalDateTime localDateTime2 = localDateTime1
.truncatedTo(ChronoUnit.DAYS);
System.out.println(localDateTime2);
}
}
Output
2018-01-17T09:54:07.362
2018-01-17T00:00
2018-01-17T00:00
Click the below link to download the code:
https://sites.google.com/site/ramj2eev1/home/javabasics/LocalDateTimeDemo_truncatedto.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/LocalDateTimeDemo_truncatedto
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/2732bd5046563d647669928b143687e5dbf4d99f/BasicJava/LocalDateTimeDemo_truncatedto/?at=master
See also:
No comments:
Post a Comment