Repository: tobymao/sqlglot

Issue:
Support Sqlite datetime functions
**Is your feature request related to a problem? Please describe.**
I've tried to run queries with SQLite dialect, and I found that the following datetime functions are not defined:
- date
- datetime
- julianday
- unixepoch
- timediff

In this link, you can see their definition [](https://www.sqlite.org/lang_datefunc.html)

**Describe the solution you'd like.**
I wanted these functions to be supported.

**Describe alternatives you've considered**
N/A

**Additional context**
N/A


Discussion:

Patch:
diff --git a/sqlglot/expressions.py b/sqlglot/expressions.py
index 5473fb16..54920fd7 100644
--- a/sqlglot/expressions.py
+++ b/sqlglot/expressions.py
@@ -4427,7 +4427,8 @@ class DateToDi(Func):
 
 # https://cloud.google.com/bigquery/docs/reference/standard-sql/date_functions#date
 class Date(Func):
-    arg_types = {"this": True, "zone": False}
+    arg_types = {"this": False, "zone": False, "expressions": False}
+    is_var_len_args = True
 
 
 class Day(Func):


Test patch:
diff --git a/tests/dialects/test_sqlite.py b/tests/dialects/test_sqlite.py
index 4cf08320..333e8f8f 100644
--- a/tests/dialects/test_sqlite.py
+++ b/tests/dialects/test_sqlite.py
@@ -59,6 +59,20 @@ class TestSQLite(Validator):
         )
 
     def test_sqlite(self):
+        self.validate_identity("SELECT DATE()")
+        self.validate_identity("SELECT DATE('now', 'start of month', '+1 month', '-1 day')")
+        self.validate_identity("SELECT DATETIME(1092941466, 'unixepoch')")
+        self.validate_identity("SELECT DATETIME(1092941466, 'auto')")
+        self.validate_identity("SELECT DATETIME(1092941466, 'unixepoch', 'localtime')")
+        self.validate_identity("SELECT UNIXEPOCH()")
+        self.validate_identity("SELECT STRFTIME('%s')")
+        self.validate_identity("SELECT JULIANDAY('now') - JULIANDAY('1776-07-04')")
+        self.validate_identity("SELECT UNIXEPOCH() - UNIXEPOCH('2004-01-01 02:34:56')")
+        self.validate_identity("SELECT DATE('now', 'start of year', '+9 months', 'weekday 2')")
+        self.validate_identity("SELECT (JULIANDAY('now') - 2440587.5) * 86400.0")
+        self.validate_identity("SELECT UNIXEPOCH('now', 'subsec')")
+        self.validate_identity("SELECT TIMEDIFF('now', '1809-02-12')")
+
         self.validate_all("SELECT LIKE(y, x)", write={"sqlite": "SELECT x LIKE y"})
         self.validate_all("SELECT GLOB('*y*', 'xyz')", write={"sqlite": "SELECT 'xyz' GLOB '*y*'"})
         self.validate_all(