Date operation

Date operation

View Answers

June 14, 2008 at 8:20 PM

Hi Deebapriya,


import java.util.*;
import java.text.DateFormat;
import java.text.SimpleDateFormat;

public class DateFormatTest {
public static void main(String[] args) {
Date date = Calendar.getInstance().getTime();
// Display a date in day, month, year format
DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
String today = df.format(date);
System.out.println("Today : " + today);
// Display date with day name in a short format
df = new SimpleDateFormat("EEE, dd/MM/yyyy");
today = df.format(date);
System.out.println("Today : " + today);

df = new SimpleDateFormat("MM/dd/yyyy");
today = df.format(date);
System.out.println("Today is :" + today);

df = new SimpleDateFormat("dd MMMM yy");
today = df.format(date);
System.out.println("Today is :" + today);
// Display date with a short day and month name
df = new SimpleDateFormat("EEE, dd MMM yyyy");
today = df.format(date);
System.out.println("Today : " + today);
// Formatting date with full day and month name and show time up to
df = new SimpleDateFormat("EEEE, dd MMMM yyyy, hh:mm:ss.SSS a");
today = df.format(date);
System.out.println("Today : " + today);
}
}

------------------------------------------


Read for more information.

http://www.roseindia.net/java/

Thanks









Related Tutorials/Questions & Answers:
Date operation - JDBC
Date operation  can anybody help me how to cast a java.util.Date... DateFormatTest { public static void main(String[] args) { Date date = Calendar.getInstance().getTime(); // Display a date in day, month, year format
Date operation - JDBC
Date operation  The same what i asked already.Still i didnt get... the html text obj into sql Date obj?  Hi friend, registration...: Department Name: Date of Birth
Advertisements
Calendar Operation
Calendar Operation  I have a date - example - 22-09-2012(start date) I have to find my end date based on the current quarter My input are month... is 23, it falls tomorrow and is not yet over so my end date should be calculated
date
date   how to insert date in database? i need coding
date
date  can u tell me how to calculate difference between a user provided date and the system date in java
date
date  can u tell me how to calculate difference between a user provided date and the system date in java
date
date  i want difference between the date entered in a jtextfield and the system date in java
date
date  how to insert date using html through the combobox
date
date  how to insert date using html through the combobox
date
date  how to insert date using html through the combobox
date
date  how to insert date using html through the combobox
Searching operation in JAva
Searching operation in JAva  Sir, I have made a project... on a particular date. Now there are thousands of letters dispatched on a particular date. I want to refine my search. Can anybody plz tell me how can I perform
Searching operation in JAva
Searching operation in JAva  Sir, I have made a project... on a particular date. Now there are thousands of letters dispatched on a particular date. I want to refine my search. Can anybody plz tell me how can I perform
Searching operation in JAva
Searching operation in JAva  Sir, I have made a project... on a particular date. Now there are thousands of letters dispatched on a particular date. I want to refine my search. Can anybody plz tell me how can I perform
Searching operation in JAva
Searching operation in JAva  Sir, I have made a project... on a particular date. Now there are thousands of letters dispatched on a particular date. I want to refine my search. Can anybody plz tell me how can I perform
date
database table name birthday (DOB date); dob with DATE data type in database while...=d.getTime(); java.sql.Date date = new java.sql.Date(t); try { System.out.println(date); Class.forName("oracle.jdbc.OracleDriver"); con
DATE
DATE  I have the following as my known parameter Effective Date... of calcultion starts My question is how to find the date of Thursday This cycle... the date of all the thursdays of the given year. import java.util.*; import
search operation - Java Beginners
search operation  how to retrive all the similar elements (search operation ) on xml document using regular expressions
Search operation in JSP page
Search operation in JSP page  How to perform search in jsp with MYSQL database plz help me
Insert Operation Error - WebSevices
Insert Operation Error  Hai, How i store my full resume in database[Mysql] using PHP. Any one Know the code..... Help me
login/logout operation
login/logout operation  how to do log in/out operations in jsp plz kindly send the steps leing behind this operation  
Java code for buffer operation...!!!
Java code for buffer operation...!!!  Implement a buffer operation using character array, storing last 100 characters inserted by user. Make method to get and retrieve???   The given code accepts the characters from
login/logout operation
login/logout operation  how to do log in/out operations in jsp plz kindly send the steps leing behind this operation  
arithmetic operation on float number
arithmetic operation on float number  hi here is my code class divs { public static void main(String args[]) { double dub=14.2f,dou; int num; num=(int)dub; dou=dub-num
ModuleNotFoundError: No module named 'kser-operation'
ModuleNotFoundError: No module named 'kser-operation'  Hi, My... named 'kser-operation' How to remove the ModuleNotFoundError: No module named 'kser-operation' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'Operation-Pluto'
ModuleNotFoundError: No module named 'Operation-Pluto'  Hi, My... named 'Operation-Pluto' How to remove the ModuleNotFoundError: No module named 'Operation-Pluto' error? Thanks   Hi, In your python
Mysql Time Operation
Mysql Time Operation       Mysql Time Operation performs the subtraction and addition of time... Time Operation. To understand an example from Time Operation , we use keyword
ModuleNotFoundError: No module named 'crawler_operation_for_youguowang'
ModuleNotFoundError: No module named 'crawler_operation_for_youguowang' ...: ModuleNotFoundError: No module named 'crawler_operation_for_youguowang' How to remove the ModuleNotFoundError: No module named 'crawler_operation_for_youguowang'
ModuleNotFoundError: No module named 'odoo13-addon-mass-operation-abstract'
ModuleNotFoundError: No module named 'odoo13-addon-mass-operation-abstract...: ModuleNotFoundError: No module named 'odoo13-addon-mass-operation-abstract' How to remove the ModuleNotFoundError: No module named 'odoo13-addon-mass-operation
ModuleNotFoundError: No module named 'odoo8-addon-stock-traceability-operation'
ModuleNotFoundError: No module named 'odoo8-addon-stock-traceability-operation...: ModuleNotFoundError: No module named 'odoo8-addon-stock-traceability-operation' How...-traceability-operation' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'odoo9-addon-account-operation-rule'
ModuleNotFoundError: No module named 'odoo9-addon-account-operation-rule' ...: ModuleNotFoundError: No module named 'odoo9-addon-account-operation-rule' How to remove the ModuleNotFoundError: No module named 'odoo9-addon-account-operation-rule
ModuleNotFoundError: No module named 'pod-user-operation'
ModuleNotFoundError: No module named 'pod-user-operation'  Hi, My... named 'pod-user-operation' How to remove the ModuleNotFoundError: No module named 'pod-user-operation' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'crawler_operation_for_youguowang'
ModuleNotFoundError: No module named 'crawler_operation_for_youguowang' ...: ModuleNotFoundError: No module named 'crawler_operation_for_youguowang' How to remove the ModuleNotFoundError: No module named 'crawler_operation_for_youguowang'
date format - Date Calendar
date format  how to convert dd-mmm-yyyy date format to gregorian... to convert date to calender. import java.util.*; import java.text.*; public...="19-Sep-2008"; DateFormat format ; Date date ; format = new
Date format - Date Calendar
Date format  please convert dd-mmm-yy date format to gregorian calendar date format.  Hi friend, Code related your Problem: import...]); Calendar calendar = new GregorianCalendar(pdt); Date time = new Date
date - Date Calendar
date   hi, sir i am doing student details project in swing but i am not getting current date in jtextfield in date it is giving ambigious error... label=new JLabel("Current Date: "); JTextField text=new JTextField(15
Date Formay - Date Calendar
Date Formay  Sir, How to comapare two different date format in java.  Hi friend, Code to compare two different date import...)) System.out.print("Current date(" + new SimpleDateFormat("dd/MM/yyyy"). format
Push and Pop operation of stack.
Description: In this tutorial of data-structure you will see push and pop operation of stack. In the previous tutorial is clearly explained the push pop operation. The drawback of implementing stack is that the size of stack
Date format - Date Calendar
Date format  Hi All, I am getting a date from database as a format 2010-15-07.I need to change it to 07/15/2010 and display it on my date field.Every time i need to check the format of the date field and make sure the correct
Date limit on Dojo Date picker - Date Calendar
Date limit on Dojo Date picker  Hi all, I am using dojo for date picker in my project. When user click on date text box, date picker will pop up. Using that component user can select date. Now I trying something different. I
Parsing into date object
Parsing into date object  Here is my code: String de = (String..."); Date d=new Date(); out.println(d); Date toDt; int oneDay = 24*60*60*1000; toDt.... But, it is showing error at the line where i performed parsing operation. Please help me
Parsing into date object
Parsing into date object  Here is my code: String de = (String..."); Date d=new Date(); out.println(d); Date toDt; int oneDay = 24*60*60*1000; toDt.... But, it is showing error at the line where i performed parsing operation. Please help me
convert current date into date format
convert current date into date format  How to get current date and convert into date format in Java or PHP
date convertion
date convertion  How to convert the string date format 23/11/2009 to original date format in asp.net
Mysql Date from Date
Mysql Date from Date       Mysql  Date from Date Time in Mysql return the Current  date. Understand with ExampleADS_TO_REPLACE_1 The Tutorial illustrate
Java Date
Java Date  Hi, What is the API for Date management in Java? How use the Java Date API for manipulating date object in Java? Provide some... of API for working with date and time objects in Java. You can also use third
Date Picker
Date Picker  "I want to set default calendar date when using datepicker. This date means auto-loaded date when the calendar appears. The default date is the current date. I want to change it. How could I do
date print
date print  how can i print the date in jsp page in the following formate month-date-year. (example. march 8 2012
date print
date print  how can i print the date in jsp page in the following formate month-date-year. (example. march 8 2012
Date & Time
Date & Time  How to insert System Date & Time in MS-ACCESS using Java

Ads