Skip to content

abdulwaheed18/Timer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This article explains the API for using Calendar, Date and Time in Java and how to format the output of a date and practical aspects of using timers to schedule tasks.
The Timer class in the java.util package schedules instances of a class called TimerTask

The Java language provides direct support for time based objects. This article gives a few examples how this API can be used. .
The class java.util.Date was the first implementation which was used for manipulating dates. The class java.util.Calendar was added in Java 1.1 and provides simplified access to storing and manipulating dates.
It is recommended to use Calendar if possible. In reality you have to convert frequently from Date to Calendar and vice versa, e.g. during database access you often get a java.sql.Date object. The following explains how to use Calendar and how to convert Dates into Calendar.

Table 1. Calendar field access

Field	Explanation
Calendar.YEAR	Identifies the year
Calendar.MONTH	Identifies the month
Calendar.DAY_OF_MONTH	Identifies the day
Calendar.HOUR	Identifies the hour
Calendar.MINUTE	Identifies the minute
Calendar.SECOND	Identifies the second

Tip
The Calendar.MONTH starts with 0. So December is 11.

About

API for using Calendar, Date and Time in Java and how to format the output of a date.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published