⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 date.js

📁 Browser independent JavaScript SDK. ClassLoader to lazy load JavaScript classes, extensions to core
💻 JS
📖 第 1 页 / 共 2 页
字号:
	* @name getSeconds
	* @return {Number}
	* @memberof Date
	* @function
	*/
	/** @ignore */
	Date.prototype._$getSeconds$_ = function(){throw "don't call me, used for reflection.";}
	/**
	* Sets the seconds in a Date object (from 0-59).
	* @name setSeconds
	* @param {Number} _seconds
	* @memberof Date
	* @function
	*/
	/** @ignore */
	Date.prototype._$setSeconds$_ = function(_seconds){throw "don't call me, used for reflection.";}
	/**
	* Returns the seconds of a Date object according to universal time (from 0-59).
	* @name getUTCSeconds
	* @return {Number}
	* @memberof Date
	* @function
	*/
	/** @ignore */
	Date.prototype._$getUTCSeconds$_ = function(){throw "don't call me, used for reflection.";}
	/**
	* Set the seconds in a Date object according to universal time (from 0-59).
	* @name setUTCSeconds
	* @param {Number} _seconds
	* @memberof Date
	* @function
	*/
	/** @ignore */
	Date.prototype._$setUTCSeconds$_ = function(_seconds){throw "don't call me, used for reflection.";}

	/**
	* Returns the milliseconds of a Date object (from 0-999).
	* @name getMilliseconds
	* @return {Number}
	* @memberof Date
	* @function
	*/
	/** @ignore */
	Date.prototype._$getMilliseconds$_ = function(){throw "don't call me, used for reflection.";}
	/**
	* Sets the milliseconds in a Date object (from 0-999).
	* @name setMilliseconds
	* @param {Number} _milliseconds
	* @memberof Date
	* @function
	*/
	/** @ignore */
	Date.prototype._$setMilliseconds$_ = function(_milliseconds){throw "don't call me, used for reflection.";}
	/**
	* Returns the milliseconds of a Date object according to universal time (from 0-999).
	* @name getUTCMilliseconds
	* @return {Number}
	* @memberof Date
	* @function
	*/
	/** @ignore */
	Date.prototype._$getUTCMilliseconds$_ = function(){throw "don't call me, used for reflection.";}
	/**
	* Sets the milliseconds in a Date object according to universal time (from 0-999).
	* @name setUTCMilliseconds
	* @param {Number} _milliseconds
	* @memberof Date
	* @function
	*/
	/** @ignore */
	Date.prototype._$setUTCMilliseconds$_ = function(_milliseconds){throw "don't call me, used for reflection.";}

	/**
	* Returns the number of milliseconds since midnight Jan 1, 1970.
	* @name getTime
	* @return {Number}
	* @memberof Date
	* @function
	*/
	/** @ignore */
	Date.prototype._$getTime$_ = function(){throw "don't call me, used for reflection.";}
	/**
	* Calculates a date and time by adding or subtracting a specified number of milliseconds to/from midnight January 1, 1970.
	* @name setTime
	* @param {Number} _time
	* @memberof Date
	* @function
	*/
	/** @ignore */
	Date.prototype._$setTime$_ = function(_time){throw "don't call me, used for reflection.";}
	/**
	* Returns the difference in minutes between local time and Greenwich Mean Time (GMT).
	* @name getTimezoneOffset
	* @return {Number}
	* @memberof Date
	* @function
	*/
	/** @ignore */
	Date.prototype._$getTimezoneOffset$_ = function(){throw "don't call me, used for reflection.";}

	/**
	* Returns a string representation of the date. Ex... Fri May 09 2008.
	* @name toDateString
	* @return {String}
	* @memberof Date
	* @function
	*/
	/** @ignore */
	Date.prototype._$toDateString$_ = function(){throw "don't call me, used for reflection.";}
	/**
	* Converts a Date object, according to Greenwich time, to a string. Use toUTCString() instead!
	* @name toGMTString
	* @memberof Date
	* @function
	*/
	/** @ignore */
	Date.prototype._$toGMTString$_ = function(){throw "don't call me, used for reflection.";}
	/**
	* Returns a string representation of the time. Ex... 21:28:42 GMT-0400 (EDT).
	* @name toTimeString
	* @memberof Date
	* @function
	*/
	/** @ignore */
	Date.prototype._$toTimeString$_ = function(){throw "don't call me, used for reflection.";}
	/**
	* Converts a Date object, according to universal time, to a string.
	* @name toUTCString
	* @memberof Date
	* @function
	*/
	/** @ignore */
	Date.prototype._$toUTCString$_ = function(){throw "don't call me, used for reflection.";}

	/**
	* Returns the difference in milliseconds from this date object to _date parameter.
	* @return {Number}
	* @param {Date} _date
	* @return {Number}
	*/
	Date.prototype.getDifference = function(_date)
	{
		return this.getTime() - _date.getTime();
	}

	/**
	* Returns whether this date object is before _date parameter.
	* @param {Date} _date
	* @return {Boolean}
	*/
	Date.prototype.isBefore = function(_date)
	{
		return this.getTime() < _date.getTime();
	}

	/**
	* Returns whether this date object is after _date parameter.
	* @param {Date} _date
	* @return {Boolean}
	*/
	Date.prototype.isAfter = function(_date)
	{
		return this.getTime() > _date.getTime();
	}

	/**
	* Returns the number of week in the year. Ex... 29.
	* @param {Number} _minimalDaysInFirstWeek
	* @return {Number}
	*/
	// This method was adopted from log4javascript -> http://www.timdown.co.uk/log4javascript
	Date.prototype.getWeekInYear = function(_minimalDaysInFirstWeek)
	{
		if(Object.isUndefined(_minimalDaysInFirstWeek)) {
			_minimalDaysInFirstWeek = Date.DEFAULT_MINIMAL_DAYS_IN_FIRST_WEEK;
		}

		var _previousSunday = new Date(this.getTime() - (this.getDay() * Date.ONE_DAY_MILLISECONDS));
		_previousSunday = new Date(_previousSunday.getFullYear(), _previousSunday.getMonth(), _previousSunday.getDate());

		var _startOfYear = new Date(this.getFullYear(), 0, 1);

		var _numberOfSundays = _previousSunday.isBefore(_startOfYear) ?
								0 : 1 + Math.floor((_previousSunday.getTime() - _startOfYear.getTime()) / Date.ONE_WEEK_MILLISECONDS);

		var _weekInYear = _numberOfSundays;

		var _numberOfDaysInFirstWeek = 7 - _startOfYear.getDay();
		if(_numberOfDaysInFirstWeek >= _minimalDaysInFirstWeek)
		{
			_weekInYear++;
		}

		return _weekInYear;
	}

	/**
	* Returns the number of week in the month. Ex... 4.
	* @param {Number} _minimalDaysInFirstWeek
	* @return {Number}
	*/
	// This method was adopted from log4javascript -> http://www.timdown.co.uk/log4javascript
	Date.prototype.getWeekInMonth = function(_minimalDaysInFirstWeek)
	{
		if(Object.isUndefined(_minimalDaysInFirstWeek)) {
			_minimalDaysInFirstWeek = Date.DEFAULT_MINIMAL_DAYS_IN_FIRST_WEEK;
		}

		var _previousSunday = new Date(this.getTime() - (this.getDay() * Date.ONE_DAY_MILLISECONDS));
		_previousSunday = new Date(_previousSunday.getFullYear(), _previousSunday.getMonth(), _previousSunday.getDate());

		var _startOfMonth = new Date(this.getFullYear(), this.getMonth(), 1);

		var _numberOfSundays = _previousSunday.isBefore(_startOfMonth) ?
								0 : Math.floor((_previousSunday.getTime() - _startOfMonth.getTime()) / Date.ONE_WEEK_MILLISECONDS);

		var _weekInMonth = _numberOfSundays;

		var _numberOfDaysInFirstWeek = 7 - _startOfMonth.getDay();
		if(_numberOfDaysInFirstWeek >= _minimalDaysInFirstWeek)
		{
			_weekInMonth++;
		}

		return _weekInMonth;
	}

	/**
	* Returns the day in the year. Ex... 360.
	* @return {Number}
	*/
	// This method was adopted from log4javascript -> http://www.timdown.co.uk/log4javascript
	Date.prototype.getDayInYear = function()
	{
		var _startOfYear = new Date(this.getFullYear(), 0, 1);
		return 1 + Math.floor((this.getTime() - _startOfYear.getTime()) / Date.ONE_DAY_MILLISECONDS);
	}

	/**
	* Not Implemented.
	* @return {String}
	*/
	Date.prototype.getTimeZone = function()
	{
		var _timezone = "xxx";

		//var _timezoneOffset = this.getTimezoneOffset();


		return _timezone;
	}

	/**
	* Returns whether this object is equal to the specified _object.
	* @param {Object} _object
	* @return {Boolean}
	*/
	Date.prototype.equals = function(_object)
	{
		if(this === _object)
		{
			return true;
		}
		if(!this.getClass().isInstance(_object))
		{
			return false;
		}

		return this.getTime() == _object.getTime();
	}

Date.PACKAGE = "";Date.CLASS = "Date";Date.SUPER_CLASS = "";Date.IMPORTS = [];Date.INTERFACES = [];Date.MIXINS = [];Date.getName = function(){return Date.CLASS;}Date.klass = new jsx.lang.Class(Date.getName());Date.prototype.getClass = function(){return Date.klass;}Date.WARNINGS = [];

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -