cancel
Showing results for 
Search instead for 
Did you mean: 

Date format ("dd-MMM-yyyy")

Former Member
0 Kudos

Hi,

Scenario 1:

Can anybody please tell me hoe to display Date using Date pIcker in date format i.e ("23-Aug-2010").

Whenver user selects Date from Date picker, date shud be displayed in ("23-Aug-2010") mention format.

Scenario 1:

How to specify the Date range to restrict date only for 32 days betweeen FromDate to Todate i.e difference between FromDate and Todate should not be greater then 32 days considering Scenario1 Date..

Kindly guide.

Thanks & Regards,

SK

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Please have a look at this thread for the date format in date picker

For scenario 2.

You can find the difference between two dates. If it exceeds the 32, you can raise the message

Please have a look at the following threads

http://www.jguru.com/forums/view.jsp?EID=489372

Kind regards

Saravanan K

former_member218672
Active Contributor
0 Kudos

Hi SK,

scenario1

take calender date and process this date using code like this below -

Calendar payDate;

payDate = Calendar.getInstance();

SimpleDateFormat dateFormat = new SimpleDateFormat("dd MMM yyyy");

dateFormat.format(payDate.getDate()));

scenario 2

take two calender instances in two parametes and calculate the diff. below is code -

Calendar c1 = Calendar.getInstance();

Calendar c2 = Calendar.getInstance();

long milis1 = cal1.getTimeInMillis();

long milis2 = cal2.getTimeInMillis();

long diff = milis2 - milis1;

long diffDays = diff / (24 * 60 * 60 * 1000);

hope it helps.

Regards,

Sen