Categories

ep.Date()

Categories: Utilities

new ep.Date()

Plugin: ep.date

Description: Using advanced date operations.

  • new ep.Date()

    version added: 6.11.0
  • new ep.Date( dateString )

    version added: 6.11.0

    dateString   A date as string in the following format "monthName day, year hours:minutes:seconds".

  • new ep.Date( milliseconds )

    version added: 6.11.0

    milliseconds   A date in milliseconds since Januar 1th 1970.

  • new ep.Date( year, month, day, [ hours, minutes, seconds ] )

    version added: 6.11.0

    year   A full year number.

    month   A zero indexed month of the year.

    day   A day of the month.

    hours   An hour in 24 hours format.

    minutes   A minute.

    seconds   A second.

The ep.Date() method works like the native javascript Date() method and supports the same prototype methods.

Getter in ep.Date() return the same value as the native function:

  • toGMTString, UTC, getDate, getDay, getFullYear, getHours, getMilliseconds, getMinutes, getMonth, getSeconds, getTime, getTimezoneOffset, getUTCDate, getUTCFullYear, getUTCHours, getUTCMilliseconds, getUTCMinutes, getUTCMonth, getUTCSeconds, getYear

Setter in ep.Date() set the same value(s) as the native function but return the current instance of ep.Date:

  • parse, setDate, setFullYear, setHours, setMilliseconds, setMinutes, setMonth, setSeconds, setTime, setUTCDate, setUTCFullYear, setUTCHours, setUTCMilliseconds, setUTCMinutes, setUTCMonth, setUTCSeconds, setYear
  • Simply date operation.

    Code:
    new ep.Date(2009,1,17)
            .addDate(4)
            .addFullYear(-2)
            .toGMTString();
    
    Results:
    Tue, 20 Feb 2009 00:00:00 GMT
    
    
  • .addDate()

    • .addDate( days )

      version added: 6.11.0

      days   A number of days.

    Sum or subtract days for the date object.

  • .addDay()

    • .addDay( days )

      version added: 6.11.0

      days   A number of days.

    Sum or subtract days for the date object.

  • .addFullYear()

    • .addFullYear( years )

      version added: 6.11.0

      years   A number of years.

    Sum or subtract years for the date object.

  • .addHours()

    • .addHours( hours )

      version added: 6.11.0

      hours   A number of hours.

    Sum or subtract hours for the date object.

  • .addMilliseconds()

    • .addDate( milliseconds )

      version added: 6.11.0

      milliseconds   A number of milliseconds.

    Sum or subtract milliseconds for the date object.

  • .addMinutes()

    • .addMinutes( minutes )

      version added: 6.11.0

      minutes   A number of minutes.

    Sum or subtract minutes for the date object.

  • .addMonth()

    • .addMonth( month )

      version added: 6.11.0

      months   A number of months.

    Sum or subtract months for the date object.

  • .addSeconds()

    • .addSeconds( seconds )

      version added: 6.11.0

      seconds   A number of seconds.

    Sum or subtract seconds for the date object.

  • .addTime()

    • .addSeconds( milliseconds )

      version added: 6.11.0

      milliseconds   A number of milliseconds.

    Sum or subtract milliseconds for the date object.

  • .addUnixTime()

    • .addUnixTime( seconds )

      version added: 6.11.0

      seconds   A number of seconds.

    Sum or subtract seconds for the date object.

  • .clone()

    • .clone()

      version added: 6.11.0

    Clone the current date object, .clone() returns a new instance of ep.Date() with the same date as the current date object.

  • .compareDate()

    • .compareDate( date )

      version added: 6.11.0

      date   A date object to compare.

    The .compareDate() method compares a date with the current date without consideration of the time. Returns an integer indication:

    • date(current date) > date(givn date) = 1
    • date(current date) == date(givn date) = 0
    • date(current date) < date(givn date) = -1
  • .compareTime()

    • .compareTime( date )

      version added: 6.11.0

      date   A date object to compare.

    The .compareTime() method compares a the time between a date and the current date without consideration of the date. Returns an integer indication:

    • time(current date) > time(givn date) = 1
    • time(current date) == time(givn date) = 0
    • time(current date) < time(givn date) = -1
  • .diffDate()

    • .diffDate( date )

      version added: 6.11.0

      date   A date object to get a diff.

    The .diffDate() method returns difference of days between current date and givn date.

  • .diffDay()

    • .diffDay( date )

      version added: 6.11.0

      date   A date object to get a diff.

    The .diffDay() method returns difference of days between current date and givn date.

  • .diffFullYear()

    • .diffFullYear( date )

      version added: 6.11.0

      date   A date object to get a diff.

    The .diffFullYear() method returns difference of years between current date and givn date.

  • .diffHours()

    • .diffHours( date )

      version added: 6.11.0

      date   A date object to get a diff.

    The .diffHours() method returns difference of hours between current date and givn date.

  • .diffMilliseconds()

    • .diffMilliseconds( date )

      version added: 6.11.0

      date   A date object to get a diff.

    The .diffMilliseconds() method returns difference of milliseconds between current date and givn date.

  • .diffMinutes()

    • .diffMinutes( date )

      version added: 6.11.0

      date   A date object to get a diff.

    The .diffMinutes() method returns difference of minutes between current date and givn date.

  • .diffMonth()

    • .diffMonth( date )

      version added: 6.11.0

      date   A date object to get a diff.

    The .diffMonth() method returns difference of months between current date and givn date.

  • .diffSeconds()

    • .diffSeconds( date )

      version added: 6.11.0

      date   A date object to get a diff.

    The .diffSeconds() method returns difference of seconds between current date and givn date.

  • .diffTime()

    • .diffTime( date )

      version added: 6.11.0

      date   A date object to get a diff.

    The .diffTime() method returns difference of miliseconds between current date and givn date.

  • .diffUnixTime()

    • .diffUnixTime( date )

      version added: 6.11.0

      date   A date object to get a diff.

    The .diffUnixTime() method returns difference of seconds between current date and givn date.

  • .getFormat()

    • .getFormat( format, [ options ] )

      version added: 6.11.0

      format   A formatter string.

      options   A map of additional options pass to the method.

    The .getFormat() returns a formatted string of the date using jQuery.i18n.

  • .getMonthLength()

    • .getMonthLength()

      version added: 6.11.0

    The .getMonthLength() method returns the the count of days in current month.

  • .getUTCUnixTime()

    • .getUTCUnixTime()

      version added: 6.11.0

    The .getUTCUnixTime() method returns the date as unixtime (seconds since Januar 1th 1970). However, it is not the local time but the Universal Coordinated Time (UTC) time get.

  • .getUnixTime()

    • .getUnixTime()

      version added: 6.11.0

    The .getUnixTime() method returns the date as unixtime (seconds since Januar 1th 1970).

  • .isLeapYear()

    • .isLeapYear()

      version added: 6.11.0

    The .isLeapYear() method returns a boolean indication wether the current date is in a leap year.

  • .setDay()

    • .setDay( day )

      version added: 6.11.0

      day   A zero index weekday.

    The .setDay() method sets the date to an other speciefied weekday in the current week.

  • .setFirstMonthDay()

    • .setFirstMonthDay()

      version added: 6.11.0

    The .setFirstMonthDay() method sets the date to to the first day of the current month.

  • .setFormat()

    • .setFormat( value, format, [ options ] )

      version added: 6.11.0

      value   A value to set as date.

      format   A formatter to patse the value.

      options   A map of additional options pass to the method.

    The .setFormat() set a date from a string with specified format using jQuery.i18n.

  • .setLastMonthDay()

    • .setLastMonthDay()

      version added: 6.11.0

    The .setLastMonthDay() method sets the date to to the last day of the current month.

  • .setUTCUnixTime()

    • .setUTCUnixTime( unixtime )

      version added: 6.11.0

      unixtime   A unixtime (seconds since Januar 1th 1970).

    The .setUTCUnixTime() method is the same as .setUnixTime(). However, it is not the local time but the Universal Coordinated Time (UTC) time set.

  • .setUnixTime()

    • .setUnixTime( unixtime )

      version added: 6.11.0

      unixtime   A unixtime (seconds since Januar 1th 1970).

    The .setUnixTime() method set the current date to the givn unixtime.