Date

Overview | File | Class | Tree | Index | Help

Zapatec Calendar

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## Class Date

    Object
       |
       +--Date

class Date

Field Summary
`Object` | `__msh_oldSetFullYear`

Method Summary
`Object` | `compareDatesOnly(date1,date2)` This function compares only years, months and days of two date objects.
`Object` | `dateEqualsTo(date)` Checks dates equality.
`Object` | `equalsTo(date)` Checks dates equality.
`Object` | `getDayOfYear()` Returns the number of the current day in the current year.
`Object` | `getMonthDays(month)` Returns the number of days in the month.
`Object` | `getWeekNumber()` Returns the number of the week in year, as defined in ISO 8601.
`Object` | `print(str)` Prints the date in a string according to the given format.
`void` | `setDateOnly(date)` Set only the year, month, date parts (keep existing time)
`void` | `setFullYear(y)` This function replaces the original Date.setFullYear() with a "safer" function which makes sure that the month or date aren't modified (unless in the exceptional case where the date is February 29 but the new year doesn't contain it).
`<static> Object` | `parseDate(str, format)` Parses a date from a string in the specified format.

Field Detail

### __msh_oldSetFullYear

    Object __msh_oldSetFullYear

Method Detail

### compareDatesOnly

    Object compareDatesOnly(date1,date2)

This function compares only years, months and days of two date objects.

Parameters:

`date1` - [Date] first date to compare

`date1` - [Date] second date to compare

Returns:

[int] -1 if date1>date2, 1 if date2>date1 or 0 if they are equal

### dateEqualsTo

    Object dateEqualsTo(date)

Checks dates equality. Ignores time.

### equalsTo

    Object equalsTo(date)

Checks dates equality. Checks time too.

### getDayOfYear

    Object getDayOfYear()

Returns the number of the current day in the current year.

### getMonthDays

    Object getMonthDays(month)

Returns the number of days in the month. The \em month parameter is optional; if not passed, the current month of \b this Date object is assumed.

Parameters:

`month` - [int, optional] the month number, 0 for January.

### getWeekNumber

    Object getWeekNumber()

Returns the number of the week in year, as defined in ISO 8601.

### print

    Object print(str)

Prints the date in a string according to the given format. The format (\b str) may contain the following specialties: - %%a - Abbreviated weekday name - %%A - Full weekday name - %%b - Abbreviated month name - %%B - Full month name - %%C - Century number - %%d - The day of the month (00 .. 31) - %%e - The day of the month (0 .. 31) - %%H - Hour (00 .. 23) - %%I - Hour (01 .. 12) - %%j - The day of the year (000 .. 366) - %%k - Hour (0 .. 23) - %%l - Hour (1 .. 12) - %%m - Month (01 .. 12) - %%M - Minute (00 .. 59) - %%n - A newline character - %%p - "PM" or "AM" - %%P - "pm" or "am" - %%S - Second (00 .. 59) - %%s - Number of seconds since Epoch - %%t - A tab character - %%W - The week number (as per ISO 8601) - %%u - The day of week (1 .. 7, 1 = Monday) - %%w - The day of week (0 .. 6, 0 = Sunday) - %%y - Year without the century (00 .. 99) - %%Y - Year including the century (ex. 1979) - %%% - A literal %% character They are almost the same as for the POSIX strftime function.

Parameters:

`str` - [string] the format to print date in.

### setDateOnly

    void setDateOnly(date)

Set only the year, month, date parts (keep existing time)

### setFullYear

    void setFullYear(y)

This function replaces the original Date.setFullYear() with a "safer" function which makes sure that the month or date aren't modified (unless in the exceptional case where the date is February 29 but the new year doesn't contain it).

Parameters:

`y` - [int] the new year to move this date to

### parseDate

    <static> Object parseDate(str, format)

Parses a date from a string in the specified format. This function requires strict following of the string to the format template, and any difference causes failure to be returned. Also function refuses to parse formats which containing number rules that have not fixed length and are not separated from the next number rule by any character string, as this requires complication of algorythm and still sometimes is impossible to parse.

Parameters:

`str` - [string] the date as a string

`format` - [string] the format to try to parse the date in

Returns:

[Date] a date object containing the parsed date or \b null if for some reason the date couldn't be parsed.

Overview | File | Class | Tree | Index | Help

Zapatec Calendar

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Documentation generated by JSDoc on Thu Aug 16 12:18:51 2007