Example #1
0
function f($d)
{
    printf("%s\n", $d);
    $d = AnewtDateTime::parse($d);
    printf("%s\n", AnewtDateTime::iso8601($d));
    printf("%s\n", AnewtDateTime::iso8601_week($d));
    printf("%s\n", AnewtDateTime::iso8601_week_day($d));
    printf("%s\n", AnewtDateTime::iso8601_day_of_year($d));
    printf("\n");
}
Example #2
0
 /**
  * Log a message.
  *
  * \param $domain
  * \param $level
  * \param $message
  *
  * \see AnewtLogHandlerBase::log
  */
 public function log($domain, $level, $message)
 {
     $name = AnewtLog::loglevel_to_string($level);
     $output = $this->format_log_message($domain, $level, $message);
     /* Optionally prefix with timestamp */
     if ($this->timestamps) {
         $date = AnewtDateTime::iso8601(AnewtDateTime::now());
         $output = sprintf('[%s] %s', $date, $output);
     }
     /* Make sure there is a trailing newline */
     if (!str_has_prefix($output, NL)) {
         $output .= NL;
     }
     fwrite($this->fp, $output);
 }
Example #3
0
 /**
  * Renders this object to a string. This method makes AnewtDateTimeAtom conform
  * to the "renderable" interface.
  *
  * \return
  *   A formatted string.
  */
 function render()
 {
     return AnewtDateTime::iso8601($this);
 }
Example #4
0
 /**
  * Renders this object to a string.
  *
  * \return
  *   A formatted string.
  */
 function __toString()
 {
     return AnewtDateTime::iso8601($this);
 }