Friday, April 24, 2009

Java: Get Day of Date (dd/mm/yyyy).

This is a simple java program to get complete date information of a Date in String as "dd/MM/yyyy". Here you can get other information as well like Month, Day, Year etc.

Customized Date and Time Formats
Pattern Output
dd MMMM yyyy EEEE 24 April 2009 Friday
dd.MM.yy 24.04.09
yyyy.MM.dd G 'at' hh:mm:ss z 2009.04.09 AD at 06:15:55 PDT
EEE, MMM d, ''yy Thu, Apr 9, '09
h:mm a 6:15 PM
H:mm:ss:SSS 18:15:55:624
K:mm a,z 6:15 PM,PDT
yyyy.MMMM.dd GGG hh:mm aaa 2009.April.09 AD 06:15 PM

Date Format Pattern Syntax
Symbol Meaning Presentation Example
G era designator Text AD
y year Number 2009
M month in year Text & Number July & 07
d day in month Number 10
h hour in am/pm (1-12) Number 12
H hour in day (0-23) Number 0
m minute in hour Number 30
s second in minute Number 55
S millisecond Number 978
E day in week Text Fri
EEEE day in week Text Tuesday
D day in year Number 189
F day of week in month Number 2 (2nd Wed in July)
w week in year Number 27
W week in month Number 2
a am/pm marker Text PM
k hour in day (1-24) Number 24
K hour in am/pm (0-11) Number 0
z time zone Text Pacific Standard Time
' escape for text Delimiter (none)
' single quote Literal '

For example in below code if you pass : "24/04/2009"
Output : Date is : 24 April 2009 Friday

/* */

import java.util.Date;
import java.text.SimpleDateFormat;

public class GetDay
public static void main(String[] args) throws Exception
String strDate = "24/04/2009";//pass your Date here

SimpleDateFormat sdf1 = new SimpleDateFormat("dd/MM/yyyy");
Date date = sdf1.parse(strDate);

SimpleDateFormat sdf2 = new SimpleDateFormat("dd MMMM yyyy EEEE");

System.out.println("Date is : " + sdf2.format(date));


  1. import java.text.SimpleDateFormat;
    import java.util.Date;

    public class DateExample2 {

    public static void main(String[] args) {

    SimpleDateFormat bartDateFormat =
    new SimpleDateFormat("EEEE-MMMM-dd-yyyy");

    Date date = new Date();


  2. cure fatty liver naturally cure fatty liver naturally cure fatty liver naturally

    Here is my web-site - holistic treatment for fatty liver disease

  3. laser treatment rosacea Childress

    My site: treating rosacea amoxicillin