Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/app/app/db/core_ext.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/app/db/core_ext.rb')
-rw-r--r--app/app/db/core_ext.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/app/db/core_ext.rb b/app/app/db/core_ext.rb
new file mode 100644
index 0000000..81046a0
--- /dev/null
+++ b/app/app/db/core_ext.rb
@@ -0,0 +1,9 @@
+# Time extensions.
+class Time
+ SQL_FORMAT = "TIMESTAMP '%Y-%m-%d %H:%M:%S'".freeze
+
+ # Formats the Time object as an SQL TIMESTAMP.
+ def to_sql_timestamp
+ strftime(SQL_FORMAT)
+ end
+end