function createDateFromVideo(dateStr) {
	var date = new Date(); // Create new date object
	date.setUTCFullYear(parseInt(dateStr.split("-")[0])); // Set year
	date.setUTCMonth(parseInt(dateStr.split("-")[1]) - 1); // Set month
	date.setUTCDate(parseInt(dateStr.split("-")[2].split(" ")[0])); // Set day of month
	date.setUTCHours(parseInt(dateStr.split(" ")[1].split(":")[0])); // Set hour
	date.setUTCMinutes(parseInt(dateStr.split(" ")[1].split(":")[1])); // Set minutes
	date.setUTCSeconds(parseInt(dateStr.split(" ")[1].split(":")[2].split(".")[0])); // Set seconds
	return date;
}

function createFriendlyDateTime(date) {
	return createFriendlyDate(date) + " " + createFriendlyTime(date);
}

function createFriendlyDate(date) {
	return toMonthName(date.getMonth()) + " " + date.getDate() + ", " + date.getFullYear();
}

function createFriendlyTime(date) {
	return toTwelveHourTime(date.getHours(), date.getMinutes());
}

function writeFriendlyDateTime(date) {
	writeFriendlyDate(date);
	document.write(" ");
	writeFriendlyTime(date);
}

function writeFriendlyDate(date) {
	document.write(createFriendlyDate(date));
}

function writeFriendlyTime(date) {
	document.write(createFriendlyTime(date));
}

function toLocalDateTime(utcYear, utcMonth, utcDate, utcHour, utcMinute, utcSecond) {
	
	// Create a new date object set to the UTC date and time
	var localDate = new Date(utcYear, utcMonth, utcDate, utcHour, utcMinute, utcSecond);
	
	// Determine difference in hours and minutes based on the timezone offset
	var tzDiffHours = localDate.getTimezoneOffset() / 60;
	var tzDiffMinutes = (tzDiffHours - parseInt(tzDiffHours)) * 60;
	
	// Set hours and minutes of our new date and factor in the timezone offset
	localDate.setHours(localDate.getHours() - parseInt(tzDiffHours));
	localDate.setMinutes(localDate.getMinutes() - parseInt(tzDiffMinutes));
	
	// Return the new date object
	return localDate;
	
}

function toUTCDateTime(localYear, localMonth, localDate, localHour, localMinute, localSecond) {
	
	// Create a new date object set to the local date and time
	var utcDate = new Date(localYear, localMonth, localDate, localHour, localMinute, localSecond);
	
	// Determine difference in hours and minutes based on the timezone offset
	var tzDiffHours = utcDate.getTimezoneOffset() / 60;
	var tzDiffMinutes = (tzDiffHours - parseInt(tzDiffHours)) * 60;
	
	// Set hours and minutes of our new date and factor in the timezone offset
	utcDate.setHours(utcDate.getHours() + parseInt(tzDiffHours));
	utcDate.setMinutes(utcDate.getMinutes() + parseInt(tzDiffMinutes));
	
	// Return the new date object
	return utcDate;
	
}

function toTwelveHourTime(hour, minute) {
	var afternoon, str = "";
	if (hour >= 12) afternoon = true;
	else afternoon = false;
	if (hour > 12) str = (hour - 12) + ":";
	else if (hour == 0) str = "12:";
	else str = hour + ":";
	if (minute < 10) str += "0";
	str += minute + " ";
	if (afternoon) str += "PM";
	else str += "AM";
	return str;
}

function toMonthName(month) {
	switch (month) {
		case 0: 	return "January";
		case 1: 	return "February";
		case 2: 	return "March";
		case 3: 	return "April";
		case 4: 	return "May";
		case 5: 	return "June";
		case 6: 	return "July";
		case 7: 	return "August";
		case 8: 	return "September";
		case 9: 	return "October";
		case 10: 	return "November";
		case 11: 	return "December";
	}
}
