<?php

class ConverterTimestamp implements IConverter
{

    public function init($properties)
    {
    }

    public function convertFrom($value,$object)
    {
        $db = $object->getDb();
        $v = $value == '' ? ':NULL' : strtoupper($db->charToTimestamp(trim((string)$value)));
        return $v;
    }

    public function convertTo($value,$object)
    {
        return $value;
    }

    public function convertColumn($value,$object)
    {
        $db = $object->getDb();
        return strtoupper($db->TimestampToChar(trim((string)$value)));
    }

    public function convertWhere($value,$object)
    {
        $db = $object->getDb();
        return strtoupper($db->TimestampToChar(trim((string)$value), 'YYYY/MM/DD'));
    }

}
?>
