Home | Ajax | BioInformatics | Dojo | EAI | EJB | Hibernate | J2ME | Java | Java Glossary | Java Servlets | JavaScript | Jboss | JDBC | JDO | Jmeter | JSF | JSP | JUnit | Maven | MySQL | Spring Framework | SQL | Struts | Technology | WAP | Web Services | XML


 
  
 
Programming Tutorials: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML
 

 
Facing Programming Problem?
Ask Questions?, Browse Latest Questions, Question-Answer Guidelines
Java
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification
  Java Applet
Questions
Comments

Getting the current date

                         

This section shows the way of getting  the current date of the system.

In this section, through the given program you can get the current date in the proper format (Day/Month/Year). This program shows the current date by using the various methods and fields of the Calendar class. These are explained as follows:

Code Description:

Calendar.MONTH:
This field of the Calendar class returns the static integer which is the value of the month of the year.

Calendar.DAY:
This field returns a static integer value which is the value of the day of the month in the year.

Calendar.YEAR:
This field returns a static integer value which is the current year.

Here is the code of the program:

import java.util.*;

public class CurrentDate{
  public static void main(String[] args){
    Calendar cal = new GregorianCalendar();
    int month = cal.get(Calendar.MONTH);
    int year = cal.get(Calendar.YEAR);
    int day = cal.get(Calendar.DAY_OF_MONTH);
    System.out.println("Current date : " + day + "/" (month + 1"/" + year);
  }
}

Download this example.

                         

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Latest Searches:
dojo debug
capture screen j2me
how to create war file
struts2 gwt
Flash Special Effects
Create table and inser
struts 1 vs struts 2
bank application
java date compare exam
String to array in jav
Javascript Menus Image
Get Image
actionlistener
Using Select Statement
download file using js
J2ME Gauge
capture image j2me
Photoshop Write messag
flex struts
sum
Tracing in a multithre
validate radio button
Copy One Database Tabl
Access Infotech
drill down using jfree
capture image
Flash Flash tutorials
insert content to text
Photoshop Effects Hole
ready made component o
linked list and window
jQuery To Slide Effect
file input output
WHERE Statement in SQL
convert byte to char
user registration
arithmetic date
java strings
width
define
jQuery To Hide the Div
scwcd
saveOrUpdate faces
login using JSP
spring MVC application
prime numbers
how to create session
com.mysql.jdbc.Driver
Bryce 3d Materials Wat
trusted root certifica
finding the square of
insert data to text fi
what is the difference
system.out.println(x
iport
how to use maps in jav
jsp mysql combo box
struts e file jpeg
binary
ascending and descendi
server side validation
how to pass same varia
2 resultset
change color in JTabl
jstl basics tomcat
Jigloo
http get example
VNCj (Java VNC S
how to capture multipl
DOM
count
how to use unique cons
Eclipse 3.4 EJB
Interview question on
href
jfreechart tutorials
java random numbers
count row in resultset
jdbc using prepared st
Horizontal splitpane
Java String toLowerCase Example
Java String toCharArray Example
Java String substring Example
Java String indexOf Example
Java String startsWith Example
Java String hashCode Example
Java String matches Example
Java String length Example
Java String lastIndexOf Example
Java String isEmpty Example
Java String equalsIgnoreCase Example
Java String equals Example
Java String endsWith Example
Java String copyValueOf Example
Java String contentEquals Example
  EAI Articles
  Java Certification
Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.