g46905
asked on
Using date properties?
I want to read a file if it is created between a particular period.The user selects the from and to fields.We compare these two fields with the date in the file.
This is what I am currently doing...
if(rD.after(toDate) && rD.before(tfromDate)){
read the file
}
If the user enters july 01 2004 as the from field, the files are being read from july 02 2004. Can you please help me with this issue?
Thanks,
This is what I am currently doing...
if(rD.after(toDate) && rD.before(tfromDate)){
read the file
}
If the user enters july 01 2004 as the from field, the files are being read from july 02 2004. Can you please help me with this issue?
Thanks,
if (rD.compareTo(toDate)<=0 && rD.compareTo(tfromDate)>=0 )
ASKER
It is still not reading the file created on that partucular date.
This is what I am using
rD : Wed Sep 01 00:00:00 CDT 2004 // the file created on the same date as fromDate is not being read.
fromDate : Wed Sep 01 00:00:00 CDT 2004
ToDate : Thu Sep 30 23:59:59 CDT 2004
if ((rD.compareTo(toDDDDt)<=0 ) && (rD.compareTo(frDDDDt)>=0) )
Any ideas would be greatly appreciated.
Thanks,
This is what I am using
rD : Wed Sep 01 00:00:00 CDT 2004 // the file created on the same date as fromDate is not being read.
fromDate : Wed Sep 01 00:00:00 CDT 2004
ToDate : Thu Sep 30 23:59:59 CDT 2004
if ((rD.compareTo(toDDDDt)<=0
Any ideas would be greatly appreciated.
Thanks,
can you run this and post the output:
System.out.println(rD);
System.out.println(frDDDDt );
System.out.println(toDDDDt );
System.out.println(rD.comp areTo(toDD DDt));
System.out.println(rD.comp areTo(frDD DDt));
System.out.println(rD);
System.out.println(frDDDDt
System.out.println(toDDDDt
System.out.println(rD.comp
System.out.println(rD.comp
ASKER
Object,
Here are the results that you have asked me for
rD : Wed Sep 01 00:00:00 CDT 2004
frDDDDt : Wed Sep 01 00:00:00 CDT 2004
toDDDDt : Thu Sep 30 23:59:59 CDT 2004
rD.compareTo(toDDDDt) : -1
rD.compareTo(frDDDDt) -1
Please let me know if you want me to try something else.Thanks for your help!
Thanks again,
Here are the results that you have asked me for
rD : Wed Sep 01 00:00:00 CDT 2004
frDDDDt : Wed Sep 01 00:00:00 CDT 2004
toDDDDt : Thu Sep 30 23:59:59 CDT 2004
rD.compareTo(toDDDDt) : -1
rD.compareTo(frDDDDt) -1
Please let me know if you want me to try something else.Thanks for your help!
Thanks again,
post the results of this:
System.out.println(rD.getT ime());
System.out.println(frDDDDt .getTime() );
System.out.println(rD.getT
System.out.println(frDDDDt
ASKER
System.out.println(rD.getT ime());
=> 1094014800000
System.out.println(frDDDDt .getTime() );
=> 1094014800219
Please lte me know if you want me to test something.
Thanks
=> 1094014800000
System.out.println(frDDDDt
=> 1094014800219
Please lte me know if you want me to test something.
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This is how I set the fromDate
cs.set(yyyy, mm, dd, 0, 0, 0);
Could you please share your thoughts on the changes that needs to take place to resolve the above mentioned issue.
Thanks,
cs.set(yyyy, mm, dd, 0, 0, 0);
Could you please share your thoughts on the changes that needs to take place to resolve the above mentioned issue.
Thanks,
ASKER
I want the milliseconds to be a default value of 0 all the time for the fromDate. Can you please suggest?
Thanks
Thanks
ASKER
I have made the change required and was able to set the milliseconds to default 0.Thanks for all your help.
cs.set(Calendar.MILLISECON D,0);
Thanks again,
cs.set(Calendar.MILLISECON
Thanks again,
good to hear you got it resolved :)