--- sqlite3.c	2017-05-26 00:15:22.000000000 +0200
+++ /tmp/sqlite3.c	2017-05-29 20:12:54.644378605 +0200
@@ -19772,6 +19772,44 @@
 }
 
 /*
+**    from_unixtime( TIMESTRING)
+**
+** Return YYYY-MM-DD HH:MM:SS
+*/
+static void from_unixtimeFunc(
+  sqlite3_context *context,
+  int argc,
+  sqlite3_value **argv
+){
+  DateTime p;
+  int i, n;
+  const unsigned char *z;
+  int eType;
+  memset(&p, 0, sizeof(p));
+  if( argc==0 ){
+    setDateTimeToCurrent(context, &p);
+    return;
+  }
+  if( (eType = sqlite3_value_type(argv[0]))==SQLITE_FLOAT
+                   || eType==SQLITE_INTEGER ){
+    setRawDateNumber(&p, sqlite3_value_double(argv[0]));
+  }else{
+    z = sqlite3_value_text(argv[0]);
+    if( !z || parseDateOrTime(context, (char*)z, &p) ){
+      return;
+    }
+  }
+  if( z==0 || parseModifier(context, (char*)"unixepoch", 9, &p) ) return;
+  computeJD(&p);
+  if( p.isError || !validJulianDay(p.iJD) ) return;
+    char zBuf[100];
+    computeYMD_HMS(&p);
+    sqlite3_snprintf(sizeof(zBuf), zBuf, "%04d-%02d-%02d %02d:%02d:%02d",
+                     p.Y, p.M, p.D, p.h, p.m, (int)(p.s));
+    sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT);
+}
+
+/*
 **    time( TIMESTRING, MOD, MOD, ...)
 **
 ** Return HH:MM:SS
@@ -20061,6 +20099,7 @@
     DFUNCTION(date,             -1, 0, 0, dateFunc      ),
     DFUNCTION(time,             -1, 0, 0, timeFunc      ),
     DFUNCTION(datetime,         -1, 0, 0, datetimeFunc  ),
+    DFUNCTION(from_unixtime,    -1, 0, 0, from_unixtimeFunc  ),
     DFUNCTION(strftime,         -1, 0, 0, strftimeFunc  ),
     DFUNCTION(current_time,      0, 0, 0, ctimeFunc     ),
     DFUNCTION(current_timestamp, 0, 0, 0, ctimestampFunc),
