Added function format_date which is format_full_time without time
[libi2ncommon] / src / timefunc.cpp
index 05aea1a..245c95e 100644 (file)
@@ -140,6 +140,18 @@ string format_full_time(time_t seconds)
     return string(buf);
 }
 
+string format_date(time_t seconds)
+{
+    char buf[50];
+    memset (buf, 0, 50);
+    struct tm ta;
+    if (localtime_r((time_t *)&seconds, &ta) == NULL)
+        memset (&ta, 0, sizeof(struct tm));
+
+    strftime (buf, 49, "%d.%m.%Y", &ta);
+    return string(buf);
+}
+
 void seconds_to_hour_minute(int seconds, int *hour, int *minute)
 {
     if (hour != NULL) {