[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] koha/C4 Date.pm
From: |
Tumer Garip |
Subject: |
[Koha-cvs] koha/C4 Date.pm |
Date: |
Mon, 06 Nov 2006 20:25:43 +0000 |
CVSROOT: /sources/koha
Module name: koha
Changes by: Tumer Garip <tgarip1957> 06/11/06 20:25:43
Modified files:
C4 : Date.pm
Log message:
All necessary date functions for koha using the fast DateTime module
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Date.pm?cvsroot=koha&r1=1.22&r2=1.23
Patches:
Index: Date.pm
===================================================================
RCS file: /sources/koha/koha/C4/Date.pm,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- Date.pm 20 Oct 2006 01:20:56 -0000 1.22
+++ Date.pm 6 Nov 2006 20:25:43 -0000 1.23
@@ -1,5 +1,5 @@
#!/usr/bin/perl
-## written by T Garip 2006-10-10
+## written by T Garip 2006-10-10 address@hidden
# Copyright 2000-2002 Katipo Communications
#
# This file is part of Koha.
@@ -17,7 +17,7 @@
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
-# $Id: Date.pm,v 1.22 2006/10/20 01:20:56 tgarip1957 Exp $
+# $Id: Date.pm,v 1.23 2006/11/06 20:25:43 tgarip1957 Exp $
package C4::Date;
@@ -32,7 +32,7 @@
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
-$VERSION = do { my @v = '$Revision: 1.22 $' =~ /\d+/g; shift(@v) . "." . join(
"_", map { sprintf "%03d", $_ } @v ); };
+$VERSION = do { my @v = '$Revision: 1.23 $' =~ /\d+/g; shift(@v) . "." . join(
"_", map { sprintf "%03d", $_ } @v ); };
@ISA = qw(Exporter);
@@ -43,6 +43,7 @@
&get_date_format_string_for_DHTMLcalendar
&DATE_diff &DATE_Add
&get_today &DATE_Add_Duration &DATE_obj &get_duration
+&DATE_subtract
);
sub get_date_format {
@@ -201,4 +202,12 @@
return $duration;
}
+sub DATE_subtract{
+my ($date1,$date2)address@hidden;
+my $dt1=DateTime::Format::ISO8601->parse_datetime($date1);
+my $dt2=DateTime::Format::ISO8601->parse_datetime($date2);
+my $dur=$dt2->subtract_datetime_absolute($dt1);## in seconds
+my $days=$dur->seconds/(60*60*24);
+return int($days);
+}
1;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] koha/C4 Date.pm,
Tumer Garip <=