<?php

	class Dateformat
	{
		public function toMysql($value)
		{
			$tmp = substr($value, 6, 4);
			$tmp .= "-". substr($value, 3, 2);
			$tmp .= "-". substr($value, 0, 2);
			return $tmp;
		}

		public function toFirebird($value)
		{
			$tmp = "";
			$tmp .= substr($value, 3, 2);
			$tmp .= "/". substr($value, 0, 2);
			$tmp .= "/". substr($value, 6, 4);
			return $tmp;
		}

		public function toHtml($value)
		{
			if ((strlen($value)==10) or (strlen($value)==19)) 
			{
				$tmp = substr($value, 8, 2) ;
				$tmp .= substr($value, 5, 2) ;
				$tmp .= substr($value, 0, 4);
				return $tmp;
			}
			return "";
		}

		public function toHtmlWidthMask($value)
		{
				$tmp = substr($value, 8, 2) ;
				$tmp .= "/" .substr($value, 5, 2) ;
				$tmp .= "/" .substr($value, 0, 4);
				return $tmp;
		}

		public function toHtmlWidthMaskTime($value)
		{
				$tmp = substr($value, 0, 2) ;
				$tmp .= ":" .substr($value, 3, 2) ."" ;
				return $tmp;
		}
	}

?>