Good morning.

I've searched around in searching for something similar, even for
integrated php functions but I didn't find it, so I've implemented it on
my own.

This is a function that convert a sql date field to a unix timestamps
using the mktime() functions. I've added it in a helper of mine (my
first one). At the end the helper code.

If you think it's useful, you can insert it in the TimeHelper for a
future release. You can also improve, trash, take it as it is; as you
like :)

Bye
Davide

<?php
class MyTimeHelper extends Helper{
   function sql2Timestamp($date){
         if(preg_match("/([0-9]{4})-([0-9]{2})-([0-9]{2})/",$date,$values)){
         return mktime(0,0,0,$values[2],$values[3],$values[1]);
      }else{
         return $date;
      }
   }
}
?>

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to