Forum Moderators: open

Message Too Old, No Replies

How to diesplay All dates between two entered values of dates by user

i.e User picks up date from x to y ,then display all dates between x & y

         

mp3mechanical

6:04 am on Nov 15, 2005 (gmt 0)

10+ Year Member



hi geeks,
i am having problem with getting dates between two entered date values by user.
i.e. User picks from the datetimepicker popup two dates 11/14/2005 & 11/27/2005 & we have to display all dates between 12 nov 2005 to 27 nov 2005 in 15 textboxes.i have tried loops,trigers but they are not working.

If you also know the method of sending these 15 values for sql query for retriveing records by thisOR sql query for diasplaying records between two enterd datres. please tell me that also.

ajkimoto

2:34 pm on Nov 15, 2005 (gmt 0)

10+ Year Member



mp3mechanical,

How about something like this. I have hard coded the beginning and ending dates as global variables.

The function loops through the date range and creates a textbox with a unique name and a line break after each one.

<script type="text/javascript">
<!--
//hard coded date globals, to be replaced by input data
dDate1=new Date('11/12/2005')
dDate2=new Date('11/25/2005')

function createDateBoxes(){
dDateBetween=new Date(dDate1.getTime()+86400000)
var nBox=1
var oBoxLoc=document.getElementById('boxDiv')
while (dDateBetween<dDate2){
//create textbox
oElement=document.createElement("INPUT")
//assign attributes
oElement.type="text"
oElement.size="50"
oElement.value=dDateBetween
oElement.name='Date'+nBox
//append textbox
oBoxLoc.appendChild(oElement)
//create line break (<br />)
oElement=document.createElement("BR")
//append line break
oBoxLoc.appendChild(oElement)
nBox++
dDateBetween=new Date(dDateBetween.getTime()+86400000)
}
}

//-->
</script>

<style type="text/css">

</style>

</head>

<body>
<button onclick="createDateBoxes()">Create Date Boxes</button>
<div id="boxDiv"></div>
</body>

</html>

Hope this helps,

ajkimoto

mp3mechanical

6:01 pm on Nov 16, 2005 (gmt 0)

10+ Year Member



Thanks for Your Reply. I wil try it & will notify you if it works nicely.
Thanks