on 06-11-2007 9:05 PM
All,
Im checking whether the entered date is in Past or not with below code: The issue is, If i give current date also its giving me an error. If i give future date then no error.
But I want to send an error message only if the date is in past...Is the below code is correct? If not pls correct me..
Date theDate = (Date)
wdContext.currentContextElement().getAttributeValue("fld");
IWDAttributeInfo attributeInfo =
wdContext.getNodeInfo().getAttribute("fld");
if (theDate.before(new Date(System.currentTimeMillis()))) {
//Throw an error message
}
Thanks
BM
Hi Bharathi M
You can simply use this type of code
if (<b>theDate</b>.after(new Date(System.currentTimeMillis())))
{
......
}
<b>theDate</b> is what you provide for checking
Check out for this Link you will have a clear idea
Regards,
Mathan MP
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
inputDate.<b>before</b>(CurrDate) //means the date has to be earlier then todays date and future date. If it is equal to todays date that means it is not before current date it is equal.
Same way goes for <b>after</b>.
So their is no inbuilt method that can check if input date is past/future including current date.
If you application needs then you have to code it u r self as explained in my above reply.
User | Count |
---|---|
78 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
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.