on 12-31-2005 9:19 AM
Hi
I'm facing a strange problem. I have an input field and have associated it to an attribute of type 'date'. when I click on the date picker ane choose the date, say, for example, if I choose 12/29/2005, it is correctly displayed as <b>12/29/2005</b> in the input field.
But when I print the value using wdcontext.currentcontextelement().getDate();,
the date is displayed as <b>12/28/2005.</b>
What could be wrong?? Please help.
Jack
I remember a bug with time zones in earlier Web Dynpro versions. If you are using a more recent version (say >= SP9) and this bug still occurs, please open an OSS message.
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Jack,
Check your printer settings for Date. Also write the code
wdComponentAPI.getMessageManager().raiseException
(wdcontext.currentcontextelement().getDate());
when the page pops up before printing.
Please reward appropriate points.
Bala
Message was edited by: Bala Krishnan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jack,
the problem is, may you are spliting the date and then displaying.
Because if you display
wdContext.currentContextElement().getDate();
It returns a date in format yyyy-mm-dd (java.sql.Date format) then you need to format the date to make it display as per your format.
Now if you see the function getMonth() for java.sql.Date, it returns month-1 for the month (i.e. 0 for jan 1 for feb etc.).
Also it returns year=current year -1900, so for 2006 you will find value getYear()=106.
Check the values accordingly and then format the date for display.
Hope that will work for you.
Ashutosh
Hi
Armin: I don't think I'm using SP9 or >. Im using 2.0.9. Does this include Sp9?
If not, where can i download SP9? Is it free?
Ashutosh:
Im having no problem with the year or month...Its only the day thats giving me a problem.
Moreover, when I use java.sql.date or java.util.date on my context attribute type, its not letting me map it to the input field.
How do I solve this problem??
jack
Jack,
Try converting ur date into String format and then try printing it,this may give u the correct result.
<b>Date mydate = wdContext.currentContextElement().getDate();
String dat = mydate.toString();</b>
Now normally set this value to the textview and c whether u r able to get the same date as picked from the datepicker.
<b>wdContext.currentContextElement().setResult(dat);</b>
Note : Result att should be of the type string.
This should solve ur problem.
Regards,
Nagarajan.
User | Count |
---|---|
77 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.