Click here to watch on Youtube:
https://www.youtube.com/watch?v=5f8LXxg2uzk&list=UUhwKlOVR041tngjerWxVccw
InstantDemo.java
Output
Click the below link to download the code:
https://sites.google.com/site/ramj2eev2/java_basics/InstantDemo_truncatedTo.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava_2018/InstantDemo_truncatedTo
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/80c7c27095bd0aa4eb0109eac12d92549dcd717d/BasicJava_2018/InstantDemo_truncatedTo/?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=5f8LXxg2uzk&list=UUhwKlOVR041tngjerWxVccw
InstantDemo.java
import java.time.Instant;
import java.time.temporal.ChronoUnit;
public class InstantDemo
{
public static void main(String[] args)
{
Instant instant = Instant.parse("2014-12-03T10:15:30.00Z");
System.out.println(instant);
/*
* Parameters:
*
* unit - the unit to truncate to, not null
*
* Returns:
*
* an Instant based on this instant with the time
* truncated, not null
*/
instant = instant.truncatedTo(ChronoUnit.DAYS);
System.out.println(instant);
}
}
import java.time.temporal.ChronoUnit;
public class InstantDemo
{
public static void main(String[] args)
{
Instant instant = Instant.parse("2014-12-03T10:15:30.00Z");
System.out.println(instant);
/*
* Parameters:
*
* unit - the unit to truncate to, not null
*
* Returns:
*
* an Instant based on this instant with the time
* truncated, not null
*/
instant = instant.truncatedTo(ChronoUnit.DAYS);
System.out.println(instant);
}
}
Output
2014-12-03T10:15:30Z
2014-12-03T00:00:00Z
2014-12-03T00:00:00Z
Click the below link to download the code:
https://sites.google.com/site/ramj2eev2/java_basics/InstantDemo_truncatedTo.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava_2018/InstantDemo_truncatedTo
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/80c7c27095bd0aa4eb0109eac12d92549dcd717d/BasicJava_2018/InstantDemo_truncatedTo/?at=master
See also:
No comments:
Post a Comment