diff options
author | Frank Schönheit <fs@openoffice.org> | 2000-10-27 06:01:07 +0000 |
---|---|---|
committer | Frank Schönheit <fs@openoffice.org> | 2000-10-27 06:01:07 +0000 |
commit | 2560887eac56090e10d727677d62a96d0be42e46 (patch) | |
tree | e606b72ba7efb9e79bdb0b44352b8b0d8bfb166b /connectivity | |
parent | 6534b66d71e86448abd1cd0ccc08b06c8220e4b4 (diff) |
new: toDate(sal_Int32) / toTime(sal_Int32)
Diffstat (limited to 'connectivity')
-rw-r--r-- | connectivity/inc/connectivity/dbconversion.hxx | 7 | ||||
-rw-r--r-- | connectivity/source/commontools/dbconversion.cxx | 27 |
2 files changed, 30 insertions, 4 deletions
diff --git a/connectivity/inc/connectivity/dbconversion.hxx b/connectivity/inc/connectivity/dbconversion.hxx index 5b1b7f33e2ef..3c2a8d42e89a 100644 --- a/connectivity/inc/connectivity/dbconversion.hxx +++ b/connectivity/inc/connectivity/dbconversion.hxx @@ -2,9 +2,9 @@ * * $RCSfile: dbconversion.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: obo $ $Date: 2000-10-24 08:54:40 $ + * last change: $Author: fs $ $Date: 2000-10-27 07:00:57 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -176,6 +176,9 @@ public: static sal_Int32 toINT32(const ::com::sun::star::util::Date& rVal); static sal_Int32 toINT32(const ::com::sun::star::util::Time& rVal); + static starutil::Date toDate(sal_Int32 _nVal); + static starutil::Time toTime(sal_Int32 _nVal); + /** convert a double which is a date value relative to a given fixed date into a date value relative to the standard db null date. */ diff --git a/connectivity/source/commontools/dbconversion.cxx b/connectivity/source/commontools/dbconversion.cxx index c547bfaf2153..8b34a9122f4a 100644 --- a/connectivity/source/commontools/dbconversion.cxx +++ b/connectivity/source/commontools/dbconversion.cxx @@ -2,9 +2,9 @@ * * $RCSfile: dbconversion.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2000-10-24 15:00:32 $ + * last change: $Author: fs $ $Date: 2000-10-27 07:01:07 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -315,6 +315,26 @@ double DBTypeConversion::getValue(const Reference<XColumn>& xVariant, return aString; } +//------------------------------------------------------------------------------ +starutil::Date DBTypeConversion::toDate(sal_Int32 _nVal) +{ + starutil::Date aReturn; + aReturn.Day = (sal_uInt16)(_nVal % 100); + aReturn.Month = (sal_uInt16)((_nVal / 100) % 100); + aReturn.Year = (sal_uInt16)(_nVal / 10000); + return aReturn; +} + +//------------------------------------------------------------------------------ +starutil::Time DBTypeConversion::toTime(sal_Int32 _nVal) +{ + starutil::Time aReturn; + aReturn.Hours = (sal_uInt16)(((sal_uInt32)(_nVal >= 0 ? _nVal : _nVal*-1)) / 1000000); + aReturn.Minutes = (sal_uInt16)((((sal_uInt32)(_nVal >= 0 ? _nVal : _nVal*-1)) / 10000) % 100); + aReturn.Seconds = (sal_uInt16)((((sal_uInt32)(_nVal >= 0 ? _nVal : _nVal*-1)) / 100) % 100); + aReturn.HundredthSeconds = (sal_uInt16)(((sal_uInt32)(_nVal >= 0 ? _nVal : _nVal*-1)) % 100); + return aReturn; +} const double fMilliSecondsPerDay = 86400000.0; //------------------------------------------------------------------------------ @@ -632,6 +652,9 @@ Date DBTypeConversion::getNULLDate(const Reference< XNumberFormatsSupplier > &xS /************************************************************************* * history: * $Log: not supported by cvs2svn $ + * Revision 1.3 2000/10/24 15:00:32 oj + * make strings unique for lib's + * * Revision 1.2 2000/10/19 11:46:15 oj * remove tools from dbtools * |