diff options
-rw-r--r-- | include/unotools/datetime.hxx | 3 | ||||
-rw-r--r-- | unotools/source/misc/datetime.cxx | 17 |
2 files changed, 20 insertions, 0 deletions
diff --git a/include/unotools/datetime.hxx b/include/unotools/datetime.hxx index 3887df2df5e2..7611299e38e2 100644 --- a/include/unotools/datetime.hxx +++ b/include/unotools/datetime.hxx @@ -44,6 +44,9 @@ namespace utl UNOTOOLS_DLLPUBLIC void typeConvert(const DateTime& _rDateTime, starutil::DateTime& _rOut); UNOTOOLS_DLLPUBLIC void typeConvert(const starutil::DateTime& _rDateTime, DateTime& _rOut); + UNOTOOLS_DLLPUBLIC void extractDate(const starutil::DateTime& _rDateTime, starutil::Date& _rOut); + UNOTOOLS_DLLPUBLIC void extractTime(const starutil::DateTime& _rDateTime, starutil::Time& _rOut); + UNOTOOLS_DLLPUBLIC ::rtl::OUString toISO8601(const starutil::DateTime& _rDateTime); UNOTOOLS_DLLPUBLIC bool ISO8601parseDateTime(const ::rtl::OUString &i_rIn, starutil::DateTime& o_rDateTime); UNOTOOLS_DLLPUBLIC bool ISO8601parseDate(const ::rtl::OUString &i_rIn, starutil::Date& o_rDate); diff --git a/unotools/source/misc/datetime.cxx b/unotools/source/misc/datetime.cxx index 068209489d6d..96de5106f388 100644 --- a/unotools/source/misc/datetime.cxx +++ b/unotools/source/misc/datetime.cxx @@ -215,6 +215,23 @@ void typeConvert(const starutil::DateTime& _rDateTime, DateTime& _rOut) } +void extractDate(const starutil::DateTime& _rDateTime, starutil::Date& _rOut) +{ + _rOut.Day = _rDateTime.Day; + _rOut.Month = _rDateTime.Month; + _rOut.Year = _rDateTime.Year; +} + + +void extractTime(const starutil::DateTime& _rDateTime, starutil::Time& _rOut) +{ + _rOut.Hours = _rDateTime.Hours; + _rOut.Minutes = _rDateTime.Minutes; + _rOut.Seconds = _rDateTime.Seconds; + _rOut.NanoSeconds = _rDateTime.NanoSeconds; +} + + OUString toISO8601(const starutil::DateTime& rDateTime) { OUStringBuffer rBuffer; |