From 20da23088ae3d5795043f8f5010c5ace91286dc7 Mon Sep 17 00:00:00 2001 From: wolfpac444 Date: Wed, 26 Mar 2003 03:57:10 +0000 Subject: [PATCH] Added format_date_in_iso function. --- C4/Date.pm | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/C4/Date.pm b/C4/Date.pm index c06ea5f490..708e7f3dfa 100644 --- a/C4/Date.pm +++ b/C4/Date.pm @@ -17,6 +17,7 @@ $VERSION = 0.01; @EXPORT = qw( &display_date_format &format_date + &format_date_in_iso ); @@ -90,4 +91,35 @@ sub format_date } } +sub format_date_in_iso +{ + my $olddate = shift; + my $newdate; + + my $dateformat = get_date_format(); + + if ( $dateformat eq "us" ) + { + Date_Init("DateFormat=US"); + $olddate = ParseDate($olddate); + } + elsif ( $dateformat eq "metric" ) + { + Date_Init("DateFormat=metric"); + $olddate = ParseDate($olddate); + } + elsif ( $dateformat eq "iso" ) + { + Date_Init("DateFormat=iso"); + $olddate = ParseDate($olddate); + } + else + { + return "9999-99-99"; + } + + $newdate = UnixDate($olddate, '%Y-%m-%d'); + + return $newdate; +} 1; -- 2.39.5