[Koha-cvs] CVS: koha/C4 Date.pm,1.7,1.8
Mike Hansen
wolfpac444 at users.sourceforge.net
Sat Mar 29 00:08:35 CET 2003
Update of /cvsroot/koha/koha/C4
In directory sc8-pr-cvs1:/tmp/cvs-serv14686/koha/C4
Modified Files:
Date.pm
Log Message:
Here we go again...
Index: Date.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Date.pm,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** Date.pm 28 Mar 2003 23:03:51 -0000 1.7
--- Date.pm 28 Mar 2003 23:08:30 -0000 1.8
***************
*** 1,4 ****
- #!/usr/bin/perl -w
-
package C4::Date;
--- 1,2 ----
***************
*** 18,25 ****
&display_date_format
&format_date
);
-
-
sub get_date_format
{
--- 16,22 ----
&display_date_format
&format_date
+ &format_date_in_iso
);
sub get_date_format
{
***************
*** 69,72 ****
--- 66,70 ----
if ( $dateformat eq "us" )
{
+ Date_Init("DateFormat=US");
$olddate = ParseDate($olddate);
$newdate = UnixDate($olddate,'%m/%d/%Y');
***************
*** 74,77 ****
--- 72,76 ----
elsif ( $dateformat eq "metric" )
{
+ Date_Init("DateFormat=metric");
$olddate = ParseDate($olddate);
$newdate = UnixDate($olddate,'%d/%m/%Y');
***************
*** 79,82 ****
--- 78,82 ----
elsif ( $dateformat eq "iso" )
{
+ Date_Init("DateFormat=iso");
$olddate = ParseDate($olddate);
$newdate = UnixDate($olddate,'%Y-%m-%d');
***************
*** 88,90 ****
--- 88,123 ----
}
+ 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;
+ __END__
More information about the Koha-cvs
mailing list