Search
DateTime.fromDateString Method
See Also
 






Creates a new DateTime object from a provided date string.

Namespace: MindFusion.Scheduling
File: DateTime.js

 Syntax

JavaScript  Copy Code

function fromDateString (dateString)

 Parameters

dateString

String. The date string to create the DateTime from.

 Return Value

DateTime. The new DateTime object, or null if a DateTime instance cannot be created from the provided string.

 Example

The following code loads calendar data from a JSON array:

JavaScript  Copy Code

function loadCalendar(data)
{
 // clear existing items from the calendar schedule
 calendar.schedule.items.clear();

 // traverse the json object and create corresponding items in the calendar schedule
 for (var i=0; i<data.length; i++)
 {
  var date = p.DateTime.fromDateString(data[i].date);
  date = p.DateTime.fromDateParts(date.year, date.month, date.day, 0,0,0);
…………..
}

 See Also