gulam
Posts: 55
|
Posted: 12/23/2011, 1:05 PM |
|
Hi,
I have a search + grid that displays member information.
I need to find out account expiring in 7,30, 60 and 90 days
In the search form, I have a list box with values - in 7days(7), 30 days(30), etc AND a hidden date field - s_future_date (date format dd/mm/yyyy)
I have a client side - on change event that takes the value from the listbox and based on what is selected calculates and populates s_future_date (without any refresh). The javascript is as follows in the on change event of the listbox.
var unix = Math.round(+new Date()/1000);
var seven = new Date((unix + 604800)*1000); //seven days from today
var thirty = new Date((unix + 2592000)*1000); // thirty days from today
var sixty = new Date((unix + 5184000)*1000); //60 days from today
var ninety = new Date((unix + 7776000)*1000); //90 days from today
if (document.jos_osemsc_billinginfo_jo.s_expiring_in.value == 7) {
document.xyz.s_future_date.value = seven;
}
else if (document.jos_osemsc_billinginfo_jo.s_expiring_in.value == 30) {
document.xyz.s_future_date.value = thirty;
}
etc
The above calculation happen correctly BUT
a) THOUGH s_future_date is a date field with the format dd/mm/yyyy, the field is populated with the java date i.e. Fri Dec 30 23:57:57 UTC+0300 2011 when I select say 7days instead of 30/12/2011 - why?
b) how do I use this date to compare against the database to display records that are <= s_future_date?
Any assistance on this will be appreciated.
Gulam
|
|
|
|