public static function formatTime($format, $time = null){

		if(empty($time)) $time = time();

		// Apply Windows-specific format mapping

		if(PHP_OS == 'WINNT'){

			$mapping = [
				'%C' => sprintf('%02d', date('Y', $time) / 100),
				'%D' => '%m/%d/%y',
				'%e' => sprintf('%\' 2d', date('j', $time)),
				'%h' => '%b',
				'%n' => "\n",
				'%r' => date('h:i:s', $time) . ' %p',
				'%R' => date('H:i', $time),
				'%t' => "\t",
				'%T' => '%H:%M:%S',
				'%u' => (($w = date('w', $time)) ? $w : 7)
			];

		   $format = str_replace(array_keys($mapping), array_values($mapping), $format);
		}

	   return strftime($format, $time);
	}