function prefixZero(n){
	if(n < 10){
		n = "0" + "" + n;
	}
	return n;
}

function getLocalDate(){
	var nowDate;
	var nowDateString;
	var nowDateMM;
	var nowDateDD;
	var nowDateYY;
	var nowDateH;
	var nowDateM;
	var nowDateS;

	nowDate = new Date();

	nowDateMM = prefixZero(nowDate.getMonth()+1);
	nowDateDD = prefixZero(nowDate.getDate());
	nowDateYY = nowDate.getFullYear();
	nowDateH = prefixZero(nowDate.getHours());
	nowDateM = prefixZero(nowDate.getMinutes());
	nowDateS = prefixZero(nowDate.getSeconds());

    nowDateString = nowDateYY + "-" + nowDateMM + "-" + nowDateDD + " " + nowDateH + ":" + nowDateM + ":" + nowDateS;
	
	return nowDateString;
}

function getLocalZone(){
	var nowDate;
	var nowOffset;
	var nowOffsetHours;
	var nowDateString;
	var nowDateMM;
	var nowDateDD;
	var nowDateYY;
	var nowDateH;
	var nowDateM;
	var nowDateS;

	var gmtHours;
	var timeZoneLocation;
	var timeZoneString;

	nowDate = new Date();
	nowOffset = nowDate.getTimezoneOffset();
	nowOffsetHours = nowOffset / 60;

	nowDateMM = prefixZero(nowDate.getMonth());
	nowDateDD = prefixZero(nowDate.getDay());
	nowDateYY = nowDate.getFullYear();
	nowDateH = prefixZero(nowDate.getHours());
	nowDateM = prefixZero(nowDate.getMinutes());
	nowDateS = prefixZero(nowDate.getSeconds());

	if(nowOffsetHours < 0){
		gmtHours = Math.abs(nowOffsetHours);
	}
	else{
		gmtHours = 0 - Math.abs(nowOffsetHours);
	}

	switch(gmtHours){
		case -12:
			timeZoneLocation = "International Date Line West";
			break;
		case -11:
			timeZoneLocation = "Midway Island, Samoa";
			break;
		case -10:
			timeZoneLocation = "Hawaii";
			break;
		case -9:
			timeZoneLocation = "Alaska";
			break;
		case -8:
			timeZoneLocation = "Pacific Time (US & Canada) ; Tijuana";
			break;
		case -7:
			timeZoneLocation = "Arizona, Chihuahua, La Paz, Mazatlan, Mountain Time (US & Canada), Central America";
			break;
		case -6:
			timeZoneLocation = "Central Time (US & Canada), Guadalajara, Mexico City, Monterrey, Saskatchewan";
			break;
		case -5:
			timeZoneLocation = "Bogota, Lima, Quito, Eastern Time (US & Canada), Indiana (East)";
			break;
		case -4:
			timeZoneLocation = "Atlantic Time (Canada), Caracas, La Paz, Santiago";
			break;
		case -3.5:
			timeZoneLocation = "Newfoundland";
			break;
		case -3:
			timeZoneLocation = "Brasilia, Buenos Aires, Georgetown, Greenland";
			break;
		case -2:
			timeZoneLocation = "Mid-Atlantic";
			break;
		case -1:
			timeZoneLocation = "Azores, Cape Verde Is.";
			break;
		case 0:
			timeZoneLocation = "Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London, Casablanca, Monrovia";
			break;
		case 1:
			timeZoneLocation = "Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna, Belgrade, Bratislava, Budapest, Ljubljana, Prague, Brussels,  Copenhagen, Madrid, Paris, Sarajevo, Skopje, Warsaw, Zagreb, West Central Africa";
			break;			
		case 2:
			timeZoneLocation = "Athens, Beirut, Istanbul, Minsk, Bucharest, Cairo, Harare, Pretoria, Helsinki, Kyiv, Riga, Sofia, Tallinn, Vlinius, Jerusalem";
			break;
		case 3:
			timeZoneLocation = "Baghdad, Kuwait, Riyadh, Moscow, St. Petersburg, Volgograd, Nairobi";
			break;
		case 3.5:
			timeZoneLocation = "Tehran";
			break;
		case 4:
			timeZoneLocation = "Abu Dhabi, Muscat, Baku, Tbilisi, Yerevan";
			break;
		case 4.5:
			timeZoneLocation = "Kabul";
			break;
		case 5:
			timeZoneLocation = "Ekaterinburg, Islamabad, Karachi, Tashkent";
			break;
		case 5.5:
			timeZoneLocation = "Chennai, Kolkata, Mumbai, New Delhi";
			break;
		case 5.75:
			timeZoneLocation = "Kathmandu";
			break;
		case 6:
			timeZoneLocation = "Almaty, Novosibirsk, Astana, Dhaka, Sri Jayawardenepura";
			break;
		case 6.5:
			timeZoneLocation = "Rangoon";
			break;
		case 7:
			timeZoneLocation = "Bangkok, Hanoi, Jakarta, Krasnoyarsk";
			break;
		case 8:
			timeZoneLocation = "Manila, Beijing, Chongging, Hong Kong, Urumqi, Irkutsk, Ulaan Bataar, Kuala Lumpur, Singapore, Perth, Taipei";
			break;
		case 9:
			timeZoneLocation = "Osaka, Sapporo, Tokyo, Seoul, Yakutsk";
			break;
		case 9.5:
			timeZoneLocation = "Adelaide, Darwin";
			break;
		case 10:
			timeZoneLocation = "Brisbane, Canberra, Melbourne, Sydney, Guam, Port Moresby, Hobart, Vladivostok";
			break;
		case 11:
			timeZoneLocation = "Magadan, Solomon Os., New Caledonia";
			break;
		case 12:
			timeZoneLocation = "Auckland, Wellington, Fiji, Kamchatka, Marshall Is.";
			break;
		case 13:
			timeZoneLocation = "Nuku'alofa";
			break;
		default:
			timeZoneLocation = "unknown";
			break;
	}

	return timeZoneLocation;
}

function getLocalGMT(){
	var nowDate;
	var nowOffset;
	var nowOffsetHours;
	var nowDateString;
	var nowDateMM;
	var nowDateDD;
	var nowDateYY;
	var nowDateH;
	var nowDateM;
	var nowDateS;

	var gmtHours;
	var timeZoneLocation;
	var timeZoneString;

	nowDate = new Date();
	nowOffset = nowDate.getTimezoneOffset();
	nowOffsetHours = nowOffset / 60;

	nowDateMM = prefixZero(nowDate.getMonth());
	nowDateDD = prefixZero(nowDate.getDay());
	nowDateYY = nowDate.getFullYear();
	nowDateH = prefixZero(nowDate.getHours());
	nowDateM = prefixZero(nowDate.getMinutes());
	nowDateS = prefixZero(nowDate.getSeconds());

	if(nowOffsetHours < 0){
		gmtHours = Math.abs(nowOffsetHours);
	}
	else{
		gmtHours = 0 - Math.abs(nowOffsetHours);
	}

	timeZoneString = "GMT";
	if(gmtHours < 0){
		timeZoneString += "minus "+Math.abs(gmtHours);
	}
	else{
		timeZoneString += "plus "+Math.abs(gmtHours);
	}

	return timeZoneString;	
}