[Koha-cvs] CVS: koha/C4 Date.pm,1.5,1.6

Mike Hansen wolfpac444 at users.sourceforge.net
Wed Mar 26 05:44:12 CET 2003


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

Modified Files:
	Date.pm 
Log Message:


Index: Date.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Date.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** Date.pm	26 Mar 2003 04:42:56 -0000	1.5
--- Date.pm	26 Mar 2003 04:44:10 -0000	1.6
***************
*** 18,25 ****
               &display_date_format
               &format_date
  );
  
  
- 
  sub get_date_format
  {
--- 18,25 ----
               &display_date_format
               &format_date
+              &format_date_in_iso
  );
  
  
  sub get_date_format
  {
***************
*** 69,72 ****
--- 69,73 ----
  	if ( $dateformat eq "us" )
  	{
+ 		Date_Init("DateFormat=US");
  		$olddate = ParseDate($olddate);
  		$newdate = UnixDate($olddate,'%m/%d/%Y');
***************
*** 74,77 ****
--- 75,79 ----
  	elsif ( $dateformat eq "metric" )
  	{
+ 		Date_Init("DateFormat=metric");
  		$olddate = ParseDate($olddate);
  		$newdate = UnixDate($olddate,'%d/%m/%Y');
***************
*** 79,82 ****
--- 81,85 ----
  	elsif ( $dateformat eq "iso" )
  	{
+ 		Date_Init("DateFormat=iso");
  		$olddate = ParseDate($olddate);
  		$newdate = UnixDate($olddate,'%Y-%m-%d');
***************
*** 88,90 ****
--- 91,124 ----
  }
  
+ 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