setDate() from a URL parameter!

Hi !

Thank you for all the nice scripts you have in your site, at the moment I’m using dhtmlxCalendar and it’s beeing very useful for me. I’m developing this system for a medical center, it has to list the Schedule for a Doctor in a particular Date.

So from a Select Option I get the DoctorId and from the dhtmlxCalendar the Date and pass this parameter by the URL with a Javascript function

I want to get the date from the URL and start the Calendar with this Date highlighted.

To get the date from the URL I use PHP

    $urldate = "-1";
    if (isset($_GET['urldate'])) {
    $urlfecha = $_GET['urldate'];
    }

Then to initializate the Calendar

    var urldate = <?php echo $urldate; ?>
    var mCal;
window.onload = function() {
mCal = new dhtmlxCalendarObject("objId",false);
mCal.setDateFormat('%d%m%Y');
mCal.setInsensitiveDates("6,0");
    mCal.setDate(urldate)
mCal.draw();

For example if I pass date “01012010” for 01 January 2010 my Calendar starts at 01 January 1970 with value 01011970.

I’m very confused here, I can’t see whats wrong, please help me guys !!!

Hello,

setDate method requires Date object as a parameter:

var cdate = new Date(2010,0,1);
mCal.setDate(cdate);