Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Javascript Problem
Lianite
I am trying to take a string that the user inputs: "yyyymmdd" and convert it into a date format to compare with the Date that is stored in our database. What is wrong with this code?
Just so you know, I am quite inexperienced when it comes to javascript.
var startDate = ( ( (params["startDate"].value).substring(5,6) ) + "/" + ( (params["startDate"].value).substring(7,8) ) + "/" + ( (params["startDate"].value).substring(1,4) ) );
var endDate = ( ( (params["endDate"].value).substring(5,6) ) + "/" + ( (params["endDate"].value).substring(7,8) ) + "/" + ( (params["endDate"].value).substring(1,4) ) );
var sDate = new Date(); // new date object
sDate.getDate( startDate.value ); //set date
var eDate = new Date(); // new date object
eDate.getDate( endDate.value ); //set date
this.queryText += " and ( pr.DT >= " + sDate.value + " )";
this.queryText += " and ( pr.DT <= " + eDate.value + " )";
Thank you in advance.
Jtrulen
Find more posts tagged with
Comments
Virgil Dodson
Hi jtrulen,
Try this:
var startDate = (params["startDate"].value).substring(5,7) + "/" + (params["startDate"].value).substring(7,9) + "/" + ( params["startDate"].value).substring(1,5); startDate;
increasing the second value by 1 value.
example enclosed
Lianite
Thanks much Virgil, worked like a charm!