added date clenser so we can use DateTime::Format::ISO8601
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 14 Jul 2005 20:15:13 +0000 (20:15 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 14 Jul 2005 20:15:13 +0000 (20:15 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@1189 dcc99617-32d9-48b4-a31d-7c20da2025e4

OpenSRF/src/perlmods/OpenSRF/Utils.pm

index f24d7d7..285e0f2 100644 (file)
@@ -334,6 +334,16 @@ sub set_psname {
        $0 = $PS_NAME if ($PS_NAME);
 }
 
+sub clense_ISO8601 {
+       my $self = shift;
+       my $date = shift || $self;
+       if ($date =~ /(\d{4})-?(\d{2})-?(\d{2}).?(\d{2}):(\d{2}):(\d{2})\.?\d*((?:-|\+)\d{2,4})?$/) {
+               my $z = $7 || '-00';
+               $date = "$1-$2-$3T$4:$5:$6$z";
+       }
+       return $date;
+}
+
 =head2 $utils_obj->daemonize('ps_name') OR daemonize('ps_name')
 
 Turns the current process into a daemon.  B<ps_name> is optional, and is used