[Koha-cvs] CVS: koha/C4 Date.pm,1.2,1.3

Mike Hansen wolfpac444 at users.sourceforge.net
Wed Mar 26 04:57:12 CET 2003


Update of /cvsroot/koha/koha/C4
In directory sc8-pr-cvs1:/tmp/cvs-serv5508/koha/C4

Modified Files:
	Date.pm 
Log Message:
Added format_date_in_iso function.


Index: Date.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Date.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** Date.pm	26 Mar 2003 03:46:20 -0000	1.2
--- Date.pm	26 Mar 2003 03:57:10 -0000	1.3
***************
*** 18,21 ****
--- 18,22 ----
               &display_date_format
               &format_date
+              &format_date_in_iso
  );
  
***************
*** 91,93 ****
--- 92,125 ----
  }
  
+ 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;





More information about the Koha-cvs mailing list