<?php
/**
 * @copyright (c) Kufer Software GmbH, Loisachstrasse 4, D-84453 Mühldorf
 */


class DateTimeOperationsOracle extends DateTimeOperationsServer
{
  
  public function getShortDateStr($datetimevalue)
  {
    return StringOperations::substr($datetimevalue, 8, 2) . '.' . StringOperations::substr($datetimevalue, 5, 2) . '.';
  }

  
  public function getFormatDate4Server($day, $month, $year)
  {
    return "TO_DATE('" . $day . '.' . $month . '.' . $year . "','dd.mm.yyyy') ";
  }

  
  public function getFormatTime4Server($minute, $hour, $day = 30, $month = 12, $year = 1899, $second = 0)
  {
    $timeformat = 'hh24:mi';
    if ($second != 0) {
      $timeformat = 'hh24:mi:ss';
    }
    
    return "TO_DATE('" . $this->getDateTimePart2Digits($day) . '.' . $this->getDateTimePart2Digits($month) . '.' . $year . ' ' . $hour . ':' . $minute . "','dd.mm.yyyy {$timeformat}')";
  }
}