on 02-21-2006 2:46 PM
Hi,
I have a Date field in my webdynpro application, I need to to read this from my current context and convert the same to a Calendar field and pass it to my model.
Calendar date = CalendarConverter.parseDate(req_date.toString());
The above code gives me a null pointer exception.
Can anyone suggest me the right way of converting a Date object to Calendar object?
Ashwini.
Ashwini,
try to use the following code snippet:
// get calendar and set your date object
Calendar c = Calendar.getInstance();
c.setTime( <YOUR_DATE_OBJECT> );
// to manipulate the fields use this
c.set(Calendar.MONTH, 1);
// to manipulate retrieve a fields use this
c.get(Calendar.MONTH);
Hope that helps you.
Sebastian Voss
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.