]> git.lyx.org Git - lyx.git/blobdiff - src/support/lyxtime.cpp
Fix bug 9798.
[lyx.git] / src / support / lyxtime.cpp
index 3150825d753f80c3dd95ae15b6147b5c4a8d5114..5415ac4eeb034057234b363d3931d7d004ca40ba 100644 (file)
@@ -40,6 +40,18 @@ string const formatted_time(time_t t, string const & fmt)
 }
 
 
+docstring formatted_datetime(time_t t, string const & fmt)
+{
+       QString qres;
+       if (fmt.empty())
+               qres = QLocale().toString(QDateTime::fromTime_t(t),
+                                         QLocale::ShortFormat);
+       else
+               qres = QLocale().toString(QDateTime::fromTime_t(t), toqstr(fmt));
+       return qstring_to_ucs4(qres);
+}
+
+
 time_t from_asctime_utc(string t)
 {
        // Example for the format: "Sun Nov  6 10:39:39 2011\n"