search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

What wacko date is this

Asked by Anonymous
15 years ago.

Ok, I give up what wacko date format is this "Thu Apr 26 09:30:00 UTC 1000 2007"

This is what fiddler shows is being sent to in the start parm of the javascript call..

This MUST be in ISO8601 at the very least..

Comment posted by Dan Letecky
15 years ago.
My fault. I'm behind the schedule with the documentation.

This has changed in DayPilot Pro and now the parameters are being passed as arguments to the javascript handler instead of the string placeholders ({0}).

The arguments passed to the TimeRangeSelectedJavaScript are:
  • start (Date object)
  • end (Date object)
  • column (string)
So you can convert it to UTC format using this code:

start.toUTCString();

The output is parsable by .NET's Convert.ToDateTime(). If you need the old format you need to convert it using a function like this:

function dateSortable(d) {
var second = d.getSeconds();
if (second < 10) second = "0" + second;
var minute = d.getMinutes();
if (minute < 10) minute = "0" + minute;
var hour = d.getHours();
if (hour < 10) hour = "0" + hour;
var day = d.getDate();
if (day < 10) day = "0" + day;
var month = d.getMonth() + 1;
if (month < 10) month = "0" + month;
var year = d.getFullYear();
return year + "-" + month + "-" + day + 'T' + hour + ":" + minute + ":" + second;
}

E.g.

dateSortable(start);

I've decided to switch to parameters instead of {0} placeholders because there is not just a single parameter in most javascript handlers and it would be messy with {0}, {1}, {2}, {3}, {4}, and {5}.

The basic documentation for time range selecting is now here: http://www.daypilot.org/time-range-selecting.html

If there is another way that would be more convenient for you just let me know.
This question is more than 3 months old and has been closed. Please create a new question if you have anything to add.