/**
 * 获取当前时间，格式YYYY-MM-DD hh:mm:ss
 */
export function getFormatDateTime(dateOrTimeOrDatetime) {
	var date = new Date();
	var d = '';
	var t = '';

	if (dateOrTimeOrDatetime == "date" || dateOrTimeOrDatetime == "datetime") {
		var seperator1 = "-";
		var year = date.getFullYear();
		var month = date.getMonth() + 1;
		var day = date.getDate();
		month = month < 9 ? "0" + month : month;
		day = day < 9 ? "0" + day : day;

		d = year + seperator1 + month + seperator1 + day;
	}

	if (dateOrTimeOrDatetime == 'time' || dateOrTimeOrDatetime == "datetime") {
		var seperator2 = ":";
		var hours = date.getHours();
		var minutes = date.getMinutes();
		var seconds = date.getSeconds();

		hours = hours < 9 ? "0" + hours : hours;
		minutes = minutes < 9 ? "0" + minutes : minutes;
		seconds = seconds < 9 ? "0" + seconds : seconds;

		t = hours + seperator2 + minutes + seperator2 + seconds;
	}

	var result = (d + " " + t).trim();

	return result;
}
