[Erp5-report] r33993 yusei - /erp5/trunk/products/ERP5Type/DateUtils.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Mar 23 11:15:48 CET 2010


Author: yusei
Date: Tue Mar 23 11:15:44 2010
New Revision: 33993

URL: http://svn.erp5.org?rev=33993&view=rev
Log:
Add copyDate function.

Modified:
    erp5/trunk/products/ERP5Type/DateUtils.py

Modified: erp5/trunk/products/ERP5Type/DateUtils.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/DateUtils.py?rev=33993&r1=33992&r2=33993&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/DateUtils.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/DateUtils.py [utf8] Tue Mar 23 11:15:44 2010
@@ -42,7 +42,8 @@
     'getMonthFraction', 'getYearFraction', 'getAccountableYearFraction',
     'getBissextilCompliantYearFraction', 'getIntervalListBetweenDates',
     'getDecimalNumberOfYearsBetween','roundMonthToGreaterEntireYear',
-    'roundDate', 'convertDateToHour', 'getNumberOfDayInMonth', 'atTheEndOfPeriod')
+    'roundDate', 'convertDateToHour', 'getNumberOfDayInMonth', 'atTheEndOfPeriod',
+    'copyDate')
 
 millis = DateTime('2000/01/01 12:00:00.001') - DateTime('2000/01/01 12:00:00')
 centis = millis * 10
@@ -519,3 +520,23 @@
   else:
     raise NotImplementedError, 'Period "%s" not Handled yet' % period
   return end
+
+def copyDate(date, year=None, month=None, day=None,
+             hour=None, minute=None, second=None, timezone=None):
+  if year is None:
+    year = datetime.year()
+  if month is None:
+    month = datetime.month()
+  if day is None:
+    day = datetime.day()
+  if hour is None:
+    hour = datetime.hour()
+  if minute is None:
+    minute = datetime.minute()
+  if second is None:
+    second = datetime.second()
+  if timezone is None:
+    timezone = datetime.timezone()
+  return DateTime('%i/%i/%i %i:%i:%d %s' % (year, month, day,
+                                            hour, minute, second,
+                                            timezone))




More information about the Erp5-report mailing list