Click here to watch on Youtube:
https://www.youtube.com/watch?v=B7s2xA15Dn0&list=UUhwKlOVR041tngjerWxVccw
Click the below Image to Enlarge:
CalendarDemo.java
Output
Refer:
https://docs.oracle.com/javase/8/docs/api/index.html?java/util/Calendar.html
Click the below link to download the code:
https://sites.google.com/site/ramj2eev2/java_basics/CalendarDemo_Intro.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava_2018/CalendarDemo_Intro
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/bb275a728500f81507bdd46f6424332d29623c06/BasicJava_2018/CalendarDemo_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=B7s2xA15Dn0&list=UUhwKlOVR041tngjerWxVccw
Click the below Image to Enlarge:
Java.util.calendar class Introduction | Java Date and Time | Date and Time in java |
import java.util.Calendar;
import java.util.Date;
public class CalendarDemo
{
public static void main(String[] args)
{
/*
* Gets a calendar using the default time zone and locale. The
* Calendar returned is based on the current time in the
* default time zone with the default FORMAT locale.
*
*/
Calendar cal = Calendar.getInstance();
System.out.println(cal);
/*
* Returns:a Date representing the time value.
*/
Date date = cal.getTime();
System.out.print("Date and Time is = " + date);
}
}
import java.util.Date;
public class CalendarDemo
{
public static void main(String[] args)
{
/*
* Gets a calendar using the default time zone and locale. The
* Calendar returned is based on the current time in the
* default time zone with the default FORMAT locale.
*
*/
Calendar cal = Calendar.getInstance();
System.out.println(cal);
/*
* Returns:a Date representing the time value.
*/
Date date = cal.getTime();
System.out.print("Date and Time is = " + date);
}
}
Output
java.util.GregorianCalendar[time=1526273176383,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Asia/Calcutta",offset=19800000,dstSavings=0,useDaylight=false,transitions=6,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2018,MONTH=4,WEEK_OF_YEAR=20,WEEK_OF_MONTH=3,DAY_OF_MONTH=14,DAY_OF_YEAR=134,DAY_OF_WEEK=2,DAY_OF_WEEK_IN_MONTH=2,AM_PM=0,HOUR=10,HOUR_OF_DAY=10,MINUTE=16,SECOND=16,MILLISECOND=383,ZONE_OFFSET=19800000,DST_OFFSET=0]
Date and Time is = Mon May 14 10:16:16 IST 2018
Date and Time is = Mon May 14 10:16:16 IST 2018
Refer:
https://docs.oracle.com/javase/8/docs/api/index.html?java/util/Calendar.html
Click the below link to download the code:
https://sites.google.com/site/ramj2eev2/java_basics/CalendarDemo_Intro.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava_2018/CalendarDemo_Intro
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/bb275a728500f81507bdd46f6424332d29623c06/BasicJava_2018/CalendarDemo_Intro/?at=master
See also:
No comments:
Post a Comment