Click here to watch on Youtube:
https://www.youtube.com/watch?v=tK6vlZxgwuc&list=UUhwKlOVR041tngjerWxVccw
Click the below Image to Enlarge:
SimpleDateFormatDemo.java
Output:
Refer:
https://docs.oracle.com/javase/8/docs/api/index.html?java/text/SimpleDateFormat.html
Click the below link to download the code:
https://sites.google.com/site/javaspringram2019/java_spring_2019/SimpleDateFormatDemo_Intro.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java_Spring_2019/tree/master/Java_2019/SimpleDateFormatDemo_Intro
Bitbucket Link:
https://bitbucket.org/ramram43210/java_spring_2019/src/4327965661b34e0cc17880946800be5f5d73f2dd/Java_2019/SimpleDateFormatDemo_Intro/?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=tK6vlZxgwuc&list=UUhwKlOVR041tngjerWxVccw
Click the below Image to Enlarge:
| java.text.SimpleDateFormat class Introduction | How to format the date and time | 
| java.text.SimpleDateFormat class Introduction | How to format the date and time | 
| java.text.SimpleDateFormat class Introduction | How to format the date and time | 
SimpleDateFormatDemo.java
import java.text.SimpleDateFormat;
import java.util.Date;
public class SimpleDateFormatDemo
{
public static void main(String[] args)
{
Date date = new Date();
System.out.println(date);
/*
* Parameters:
*
* pattern - the pattern describing the date and time format
*/
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
/*
* Parameters:
*
* date - the time value to be formatted into a time string.
*
* Returns:
*
* the formatted time string.
*/
String strDate = formatter.format(date);
System.out.println(strDate);
}
}
import java.util.Date;
public class SimpleDateFormatDemo
{
public static void main(String[] args)
{
Date date = new Date();
System.out.println(date);
/*
* Parameters:
*
* pattern - the pattern describing the date and time format
*/
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
/*
* Parameters:
*
* date - the time value to be formatted into a time string.
*
* Returns:
*
* the formatted time string.
*/
String strDate = formatter.format(date);
System.out.println(strDate);
}
}
Output:
Mon Jan 07 09:10:32 IST 2019
07/01/2019
07/01/2019
Refer:
https://docs.oracle.com/javase/8/docs/api/index.html?java/text/SimpleDateFormat.html
Click the below link to download the code:
https://sites.google.com/site/javaspringram2019/java_spring_2019/SimpleDateFormatDemo_Intro.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java_Spring_2019/tree/master/Java_2019/SimpleDateFormatDemo_Intro
Bitbucket Link:
https://bitbucket.org/ramram43210/java_spring_2019/src/4327965661b34e0cc17880946800be5f5d73f2dd/Java_2019/SimpleDateFormatDemo_Intro/?at=master
See also:
 


 
No comments:
Post a Comment