From: miker Date: Thu, 14 Jul 2005 20:15:13 +0000 (+0000) Subject: added date clenser so we can use DateTime::Format::ISO8601 X-Git-Tag: osrf_rel_2_0_1~1479 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=32a240f11da661c63ddfb469a1242f2736245f46;p=OpenSRF.git added date clenser so we can use DateTime::Format::ISO8601 git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@393 9efc2488-bf62-4759-914b-345cdb29e865 --- diff --git a/src/perlmods/OpenSRF/Utils.pm b/src/perlmods/OpenSRF/Utils.pm index f24d7d7..285e0f2 100644 --- a/src/perlmods/OpenSRF/Utils.pm +++ b/src/perlmods/OpenSRF/Utils.pm @@ -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 is optional, and is used