on 03-03-2009 12:03 PM
HI all,
I want to set the dates of the current month as default, for ex
Input field1 - 01/03/2009 (default), first day of the current month.
Input field2 - 31/03/2009 (default), last day of the current month.
Regards
You may use getDate() method of java.util.date to get current date. Or use getMonth()
to get the current month & getYear() to get current year. Set your first input field in init
method of the view... for example, as "1/<current month>/<current year>".
Then depending upon how many days the current month has, set the last date of the
month in 2nd input field.
There is this document on SDN on how to implement calendar UI in webdynpro.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Create two context attributes of type Date and bind this to respective ui elements
Use the calendar and date api from java to do this.
Regards
Ayyapparaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
//last day of month
Calendar c = Calendar.getInstance();
c.set(2009,3,3); //today
c.set(Calendar.DAY_OF_MONTH, c.getActualMaximum(Calendar.DAY_OF_MONTH));
//first date og month
Calendar c2 = Calendar.getInstance();
c2.set(2009,3,3); //today
c2.set(Calendar.DAY_OF_MONTH, c2.getActualMinimum(Calendar.DAY_OF_MONTH));
//test your code
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
System.out.println("last: " + sdf.format(c.getTime()));
System.out.println("first: " + sdf.format(c2.getTime()));
Good luck,
Ola
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Use
Calendar c = Calendar.getInstance();
String DATE_FORMAT_NOW = "dd-MM-yyyy";
SimpleDateFormat date_format = new SimpleDateFormat(DATE_FORMAT_NOW);
c.getTime();
date_format.format(c.getTime());
//for current
wdComponentAPI.getMessageManager().reportWarning(date_format.format(c.getTime()) +" ");
c.set(Calendar.DAY_OF_MONTH, c.getActualMaximum(Calendar.DAY_OF_MONTH));
//for last
wdComponentAPI.getMessageManager().reportWarning(date_format.format(c.getTime()) +" ");
Best Regards
Satish Kumar
Edited by: satish jhariya on Mar 3, 2009 5:59 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.