Search
DateTime.fromDateParts Method
See Also
Collapse All Expand All Language Filter: All Language Filter: Multiple Language Filter: None Language Filter: C# Language Filter: Visual Basic Language Filter: Java Language Filter: JavaScript Language Filter: C++ Language Filter: XAML
C#
Visual Basic
Java
JavaScript
C++
XAML
Introduction
General Information
What's New In This Release
Version History
Getting Started
Code Completion With VSDoc IntelliSense
Programming Interface Overview
Tutorials
Reference
MindFusion.Common
MindFusion.Common.Collections
MindFusion.Controls
MindFusion.Scheduling
BaseForm Class
ButtonEventArgs Class
Calendar Class
CalendarView Enumeration
CellEventArgs Class
Contact Class
CueForm Class
DailyRecurrence Enumeration
DateChangedEventArgs Class
DateTime Class
DateTime Members
DateTime Constructor
DateTime Methods
__getDate Method
__getDay Method
__getFullYear Method
__getHours Method
__getMilliseconds Method
__getMinutes Method
__getMonth Method
__getSeconds Method
__getTime Method
__getTimezoneOffset Method
__getUTCDate Method
__getUTCDay Method
__getUTCFullYear Method
__getUTCHours Method
__getUTCMilliseconds Method
__getUTCMinutes Method
__getUTCMonth Method
__getUTCSeconds Method
__setDate Method
__setFullYear Method
__setHours Method
__setMilliseconds Method
__setMinutes Method
__setSeconds Method
__setTime Method
__setUTCDate Method
__setUTCFullYear Method
__setUTCHours Method
__setUTCMilliseconds Method
__setUTCMinutes Method
__setUTCSeconds Method
__toDateString Method
__toLocaleDateString Method
__toLocaleString Method
__toLocaleTimeString Method
__toString Method
__toTimeString Method
__toUTCString Method
__valueOf Method
addDays Method
addHours Method
addMilliseconds Method
addMinutes Method
addMonths Method
addSeconds Method
addYears Method
clone Method
combine Method
compareTo Method
daysBetween Method
equals Method
fromDateParts Method
fromDateString Method
fromMilliseconds Method
getDate Method
getDayOfMonth Method
getDayOfWeek Method
getDaysInMonth Method
getMonth Method
getWeekFirstDate Method
getYear Method
greaterThan Method
greaterThanOrEqual Method
hoursBetween Method
isLeapYear Method
lessThan Method
lessThanOrEqual Method
maxDate Method
maxValue Method
millisecondsBetween Method
minDate Method
minutesBetween Method
minValue Method
monthsBetween Method
now Method
secondsBetween Method
subtract Method
today Method
toString Method
valueOf Method
weeksBetween Method
yearsBetween Method
DateTime Properties
DayOfWeek Enumeration
DayOfWeekFormat Enumeration
DayOfWeekType Enumeration
DaysOfWeek Enumeration
FormEventArgs Class
GroupType Enumeration
HeaderEventArgs Class
HeaderType Enumeration
HorizontalHeaderStyle Enumeration
Item Class
ItemEventArgs Class
ItemModifiedEventArgs Class
ItemModifyAction Enumeration
ItemModifyingEventArgs Class
ItemSettings Class
JsonPersistContext Class
Keys Enumeration
ListSettings Class
LocalStrings Class
Location Class
MainHeaderStyle Enumeration
MonthlyRecurrence Enumeration
MonthRangeSettings Class
MonthSettings Class
Occurrence Enumeration
Orientation Enumeration
Recurrence Class
RecurrenceEnd Enumeration
RecurrenceException Class
RecurrencePattern Enumeration
RecurrenceState Enumeration
Reminder Class
ReminderType Enumeration
Resource Class
ResourceViewSettings Class
ResourceViewTimeline Enumeration
Schedule Class
Selection Class
SelectionEventArgs Class
Task Class
TaskEventArgs Class
TaskPriority Enumeration
TaskStatus Enumeration
TimelineSettings Class
TimeRange Class
TimeSpan Class
TimetableSettings Class
TimeUnit Enumeration
VerticalHeaderStyle Enumeration
ViewCell Class
WebComponents Class
WeekRangeSettings Class
WeekRangeViewStyle Enumeration
XmlPersistContext Class
YearlyRecurrence Enumeration
Licensing
Online Resources
Technical Support
MindFusion Products

Creates a new DateTime object, by specifying its different date and time components.

Namespace: MindFusion.Scheduling
Assembly: DateTime.js

## Syntax

JavaScript Copy Code
function fromDateParts (year, month, [day, [hours, [minutes, [seconds, [milliseconds]]]]])

### Parameters

year

  Number. The year component.

month

  Number. The month component (0-11).

day
  Optional.

  Number. The day component (1-31). If not provided, a default value of 1 will be used.

hours
  Optional.

  Number. The hours component (0-23). If not provided, a default value of 0 will be used.

minutes
  Optional.

  Number. The minutes component (0-59). If not provided, a default value of 0 will be used.

seconds
  Optional.

  Number. The seconds component (0-59). If not provided, a default value of 0 will be used.

milliseconds
  Optional.

  Number. The milliseconds component (0-999). If not provided, a default value of 0 will be used.

### Return Value

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

## 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

DateTime Members
DateTime Class
MindFusion.Scheduling Namespace