dojox/date/persian/Date (version 1.10)

Summary

The component defines the Persian (Hijri) Calendar Object

This module is similar to the Date() object provided by JavaScript

Usage

var foo = new Date();
dojox/date/persian/Date
<

This function initialize the date object values

>This function initialize the date object values

>

Examples

Example 1

var date = new dojox.date.persian.Date();
document.writeln(date.getFullYear()+'\'+date.getMonth()+'\'+date.getDate());

Property Summary

Method Summary

Properties

_date
_day
_GREGORIAN_EPOCH
_hours
_milliseconds
_minutes
_month
_PERSIAN_EPOCH
_seconds
_year
daysInMonth

Methods

_addMilliseconds(milliseconds)
Parameter Type Description
milliseconds Number
Returns:function
_addMinutes(minutes)
Parameter Type Description
minutes Number
Returns:function
_addSeconds(seconds)
Parameter Type Description
seconds Number
Returns:function
_mod(a,b)
Parameter Type Description
a undefined
b undefined
Returns:number
_monthStart(year,month)

return the start of Persian Month

Parameter Type Description
year Number
month Number
Returns:number
_yearStart(year)

return start of Persian year

Parameter Type Description
year Number
Returns:number
calcGregorian(year,month,day)
Parameter Type Description
year undefined
month undefined
day undefined
Returns:instance
fromGregorian(gdate)

This function returns the equivalent Persian Date value for the Gregorian Date

Parameter Type Description
gdate Date
Returns:function

This function returns the equivalent Persian Date value for the Gregorian Date

Examples

Example 1

var datePersian = new dojox.date.persian.Date();
var dateGregorian = new Date(2008,10,12);
datePersian.fromGregorian(dateGregorian);
getDate()

This function returns the date value (1 - 30)

Returns:undefined

Examples

Example 1

var date1 = new dojox.date.persian.Date();
document.writeln(date1.getDate);
getDay()

This function return Week Day value ( 0 - 6 )

Returns:undefined

Examples

Example 1

var date1 = new dojox.date.persian.Date();
document.writeln(date1.getDay());
getDaysInPersianMonth(month,year)

returns the number of days in the given Persian Month

Parameter Type Description
month Number
year Number
Returns:undefined
getDaysInPersianMonth(month)
Parameter Type Description
month dojox/date/persian.Date
getFullYear()

This function return the Year value

Returns:undefined

Examples

Example 1

var date1 = new dojox.date.persian.Date();
document.writeln(date1.getFullYear());
getHours()

returns the Hour value

Returns:undefined
getMilliseconds()

returns the Milliseconds value

Returns:undefined
getMinutes()

returns the Minutes value

Returns:undefined
getMonth()

This function return the month value ( 0 - 11 )

Returns:undefined

Examples

Example 1

var date1 = new dojox.date.persian.Date();
document.writeln(date1.getMonth()+1);
getSeconds()

returns the seconds value

Returns:undefined
gregorian_to_jd(year,month,day)
Parameter Type Description
year undefined
month undefined
day undefined
Returns:number
isLeapYear(j_y,j_m,j_d)

return Boolean value if Persian leap year

Parameter Type Description
j_y undefined
j_m undefined
j_d undefined
Returns:boolean
jd_to_gregorian(jd,jmonth)
Parameter Type Description
jd undefined
jmonth undefined
Returns:instance
jd_to_persian(jd)
Parameter Type Description
jd undefined
Returns:instance
jwday(j)
Parameter Type Description
j undefined
Returns:undefined
leap_gregorian(year)
Parameter Type Description
year undefined
Returns:boolean
persian_to_jd(year,month,day)
Parameter Type Description
year undefined
month undefined
day undefined
Returns:number
setDate(date)

This function sets the Date

Parameter Type Description
date number
Returns:function

This function sets the Date

Examples

Example 1

var date1 = new dojox.date.persian.Date();
date1.setDate(2);
setFullYear(year)

This function set Year

Parameter Type Description
year number

Examples

Example 1

var date1 = new dojox.date.persian.Date();
date1.setYear(1429);
setHours()

set the Hours

setMilliseconds(milliseconds)
Parameter Type Description
milliseconds Number
Returns:function
setMinutes(minutes)

sets the minutes (0-59) only.

Parameter Type Description
minutes Number
Returns:function

sets the minutes (0-59) only.

setMonth(month)

This function set Month

Parameter Type Description
month number

Examples

Example 1

var date1 = new dojox.date.persian.Date();
date1.setMonth(2);
setSeconds(seconds)

sets the seconds (0-59) only.

Parameter Type Description
seconds Number
Returns:function

sets the seconds (0-59) only.

toGregorian()

This returns the equevalent Grogorian date value in Date object

Returns:instance

Examples

Example 1

var datePersian = new dojox.date.persian.Date(1429,11,20);
var dateGregorian = datePersian.toGregorian();
toString()

This returns a string representation of the date in "DDDD MMMM DD YYYY HH:MM:SS" format

Returns:string

Examples

Example 1

var date1 = new dojox.date.persian.Date();
document.writeln(date1.toString());
valueOf()

This function returns The stored time value in milliseconds since midnight, January 1, 1970 UTC

Returns:undefined
Error in the documentation? Can’t find what you are looking for? Let us know!