A
MICROPROJECT REPORT
On
“CREATE A DIGITAL CLOCK”
Mr. Sonawane Anuj Sandip
Mr. Pachore Aditya Vasantrao
Ms. Daware Siddhi Santosh
Ms. Nawale Tanuja Sunil
Under The Guidance of
Prof.V.Y.Gholap
THIRD YEAR (COMPUTER) DEPARTMENT
AKOLE TALUKA EDUCATION SOCIETY’S
FACULTY OF POLYTECHNIC, AKOLE
ACADEMIC YEAR - 2024-25
CERTIFICATE
This is to certify that the Micro-Project Report entitled
“CREATE A DIGITAL CLOCK”
Has been submitted by,
Mr. Sonawane Anuj Sandip
Mr. Pachore Aditya Vasantrao
Ms. Daware Siddhi Santosh
Ms. Nawale Tanuja Sunil
As a partial fulfillment of the prescribed syllabus of Subject
Advance java programming (22517), (Micro-Project) of Third Year
Diploma in Computer Engineering.
Prof. V. Y. Gholap Prof. S. B. Deshmukh
Project Guide & Subject Teacher Head of Department
Dr. R. D. Palhade
Principal
ACKNOWLEDGEMENT
It is privilege to acknowledge with deep sense of gratitude to our micro
project guide Prof. V. Y. Gholap for her valuable suggestions through out our
course of study.
We express our gratitude to Head of Department, Prof. S. B. Deshmukh
for his kind help & co-operation.
We also take this opportunity to thank all our colleagues who backed us
interest by giving useful suggestions & all possible help without whose help&
moral support it would not has been possible to complete this report.
Mr. Sonawane Anuj Sandip
Mr. Pachore Aditya Vasantrao
Ms. Daware Siddhi Santosh
Ms. Nawale Tanuja Sunil
CREATE A CLOCK
INDEX
Sr.no Title Page no.
1. Introduction 2
2. Clock 3
3. Program 4
4. Result 6
5. Conclusion 7
6. Reference 8
1
CREATE A CLOCK
INTRODUCTION
A digital clock, as opposed to an analog clock, shows the time digitally. In
this tutorial, we will develop a digital clock using Advance java programming.
We are going to discuss a Advance java programming program to build a
digital clock in Advance java programming. It will help us to practice conditional
statements and loops concepts of Advance java programming programming. Our
digital clock program will get local time with hour, min,sec type variables. The
structure has time attributes that we will use to initialize our variables. Finally,
we will avail an infinite while loop to build an amazing digital clock program
in Advance java programming.
2
CREATE A CLOCK
CLOCK
In this article, we will discuss the Digital Clock in Advance java
programming Language. It is an application that allows for a personal clock that
starts at a live time and shows the time from that point onwards. This article
describes how to make sucha clock in a 24-hour format with HH:MM:SS slots
and start the time from where one would want it to be, and then it moves forward
from there.
Features:
It is a Simple Digital clock developed using basic Advance java
programming concepts thatshows hour, minute, second, day & date.
Approach:
The requirements for this program are just the basic concepts of Advance
java programming
Create a screen that will show “Current time” of your location which will
be implemented using simple output methods used in Advance java
programming.
In the fore mentioned screen, implementthe HH column, MM column, SS
column, that will contain the time.
In the last screen, a digital clock can be seen finally implemented and
running from the time.
3
CREATE A CLOCK
PROGRAM
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.Timer;
public class Digital_clock extends JFrame {
private JLabel timeLabel;
private JLabel dateLabel;
public Digital_clock() {
setTitle("Digital Clock");
setSize(600, 300);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setResizable(false);
// Create a panel to hold the time and date labels
JPanel panel = new JPanel();
panel.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
panel.setLayout(new BorderLayout());
// Create a label to display the time
timeLabel = new JLabel();
timeLabel.setFont(new Font("Arial", Font.PLAIN, 60));
timeLabel.setHorizontalAlignment(SwingConstants.CENTER);
timeLabel.setVerticalAlignment(SwingConstants.CENTER);
timeLabel.setForeground(Color.RED);
// Create a label to display the date
dateLabel = new JLabel();
dateLabel.setFont(new Font("Arial", Font.PLAIN, 20));
4
CREATE A CLOCK
dateLabel.setHorizontalAlignment(SwingConstants.CENTER);
dateLabel.setVerticalAlignment(SwingConstants.CENTER);
dateLabel.setForeground(Color.WHITE);
// Add the time and date labels to the panel
panel.add(timeLabel, BorderLayout.CENTER);
panel.add(dateLabel, BorderLayout.SOUTH);
// Set the panel's background color
panel.setBackground(Color.BLACK);
// Add the panel to the frame
add(panel);
// Use a Timer to update the time and date labels every second
Timer timer = new Timer(1000, new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
updateTimeAndDate();
}
});
timer.start();
}
private void updateTimeAndDate() {
// Get the current time and format it
Calendar calendar = Calendar.getInstance();
SimpleDateFormat timeFormatter = new SimpleDateFormat("HH:mm:ss");
String time = timeFormatter.format(calendar.getTime());
// Get the current date and format it
SimpleDateFormat dateFormatter = new SimpleDateFormat("EEE, MMM dd,
yyyy");
String date = dateFormatter.format(calendar.getTime());
// Update the time and date labels
timeLabel.setText(time);
dateLabel.setText(date);
}
public static void main(String[] args) {
Digital_clock clock = new Digital_clock();
clock.setVisible(true);
5
CREATE A CLOCK
}
}
RESULT
6
CREATE A CLOCK
CONCLUSION
At last, would like to share my experience while doing this micro project.
We learnt many new things about the given topics. The best thing which I can
share is that I developed more interest in this subject. This project gave me real
insight into the create clock world.
A very special thanks to my dear Principal for setting such targets for us. I
enjoyed each and every bit work I had put into this project.
7
CREATE A CLOCK
REFERENCE
The Basics - How Digital Clocks Work | HowStuffWorks
What is a Digital Clock - Teaching Wiki - Twinkl
https://www.globalspec.com/.../203279/chapter-1-
introduction-to-clocks
Digital Clock starting from live time - GeeksforGeeks
What is a Digital Clock - Teaching Wiki - Twinkl
11