Click here to watch on Youtube :
https://www.youtube.com/watch?v=nIh8UeNVfDg&list=UUhwKlOVR041tngjerWxVccw
LocalTimeDemo.java
Output
Click the below link to download the code:
https://sites.google.com/site/ramj2eev1/home/javabasics/LocalTimeDemo_atDate.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/LocalTimeDemo_atDate
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/0f51b390145d58b657670d4890d43cef82a5202a/BasicJava/LocalTimeDemo_atDate/?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=nIh8UeNVfDg&list=UUhwKlOVR041tngjerWxVccw
LocalTimeDemo.java
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
public class LocalTimeDemo
{
public static void main(String[] args)
{
LocalDate localDate = LocalDate.now();
System.out.println(localDate);
LocalTime localTime = LocalTime.parse("12:30:30");
System.out.println(localTime);
/*
* Parameters:
*
* date - the date to combine with, not null
*
* Returns:
*
* the local date-time formed from this time and the specified
* date, not null
*/
LocalDateTime localDatetime = localTime.atDate(localDate);
System.out.println(localDatetime);
}
}
import java.time.LocalDateTime;
import java.time.LocalTime;
public class LocalTimeDemo
{
public static void main(String[] args)
{
LocalDate localDate = LocalDate.now();
System.out.println(localDate);
LocalTime localTime = LocalTime.parse("12:30:30");
System.out.println(localTime);
/*
* Parameters:
*
* date - the date to combine with, not null
*
* Returns:
*
* the local date-time formed from this time and the specified
* date, not null
*/
LocalDateTime localDatetime = localTime.atDate(localDate);
System.out.println(localDatetime);
}
}
Output
2018-01-09
12:30:30
2018-01-09T12:30:30
12:30:30
2018-01-09T12:30:30
Click the below link to download the code:
https://sites.google.com/site/ramj2eev1/home/javabasics/LocalTimeDemo_atDate.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/LocalTimeDemo_atDate
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/0f51b390145d58b657670d4890d43cef82a5202a/BasicJava/LocalTimeDemo_atDate/?at=master
See also:
No comments:
Post a Comment