added date clenser so we can use DateTime::Format::ISO8601
authormiker <miker@9efc2488-bf62-4759-914b-345cdb29e865>
Thu, 14 Jul 2005 20:15:13 +0000 (20:15 +0000)
committermiker <miker@9efc2488-bf62-4759-914b-345cdb29e865>
Thu, 14 Jul 2005 20:15:13 +0000 (20:15 +0000)
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@393 9efc2488-bf62-4759-914b-345cdb29e865

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