Javascript-форум (https://javascript.ru/forum/)
-   Элементы интерфейса (https://javascript.ru/forum/dom-window/)
-   -   Таймер на javascript. Как изменить под себя? (https://javascript.ru/forum/dom-window/62932-tajjmer-na-javascript-kak-izmenit-pod-sebya.html)

elshaarawy 08.05.2016 02:15

Таймер на javascript. Как изменить под себя?
 
Доброго времени суток.
Хочу сделать себе таймер. Нашел скрипт countdown js, но там идет обратный отсчет и нету года. Подскажите пожалуйста что поменять в скрипте?
Вот он http://codecanyon.net/item/jcountdow...3480?ref=lvraa

elshaarawy 08.05.2016 03:21

Вложений: 1
Разобрался ребят. Скрипт работает. Но я взял его с сайта рабочего и там на таймере написано 12 лет 10 месяцев 22 дней 3 мин 2 сек

А как мне сделать, чтоб отсчет шел мой личный? Скажем я хочу начать с
5 лет 3 месяца и тд

Приатачил файлик.

Я полагаю изменения надо делать тут

/* Convert a date/time to UTC.
	   @param  tz     (number) the hour or minute offset from GMT, e.g. +9, -360
	   @param  year   (Date) the date/time in that timezone or
	                  (number) the year in that timezone
	   @param  month  (number, optional) the month (0 - 11) (omit if year is a Date)
	   @param  day    (number, optional) the day (omit if year is a Date)
	   @param  hours  (number, optional) the hour (omit if year is a Date)
	   @param  mins   (number, optional) the minute (omit if year is a Date)
	   @param  secs   (number, optional) the second (omit if year is a Date)
	   @param  ms     (number, optional) the millisecond (omit if year is a Date)
	   @return  (Date) the equivalent UTC date/time */
	UTCDate: function(tz, year, month, day, hours, mins, secs, ms) {
		if (typeof year == 'object' && year.constructor == Date) {
			ms = year.getMilliseconds();
			secs = year.getSeconds();
			mins = year.getMinutes();
			hours = year.getHours();
			day = year.getDate();
			month = year.getMonth();
			year = year.getFullYear();
		}
		var d = new Date();
		d.setUTCFullYear(year);
		d.setUTCDate(1);
		d.setUTCMonth(month || 0);
		d.setUTCDate(day || 1);
		d.setUTCHours(hours || 0);
		d.setUTCMinutes((mins || 0) - (Math.abs(tz) < 30 ? tz * 60 : tz));
		d.setUTCSeconds(secs || 0);
		d.setUTCMilliseconds(ms || 0);
		return d;
	},


Часовой пояс GMT +3, время: 16:46.