💻
notes
  • Initial page
  • sql
    • date-and-time
    • Ordering Columns
    • Replacing Portions of Text
    • count-rows
    • Changing the Case of Strings
    • Create Excerpts with Substring
    • Transactions
    • removing-data
    • Finding Length of Strings
    • add-row-to-a-table
    • limit-and-paginate-results
    • Concatenating Strings
    • SQL JOINs
    • basic-math
    • updating-rows-in-a-table
    • Subqueries
    • Set Operations
    • SQL Basics Cheatsheet
  • ruby
    • gems
      • Auto use Ruby version with gemset
      • Must Have Gems
      • Create Devise user without any validation
    • rails
      • What are the differences between #where and #find?
  • postgresql
    • Export database dump from Heroku and import to local database
  • glossary
  • vim
    • Edit Recorded Macros
    • Sort Multiple Lines
    • Search and Replace
    • Folding
  • iTerm
  • git
    • Git
  • Command Line Utilities
  • How To Use Notes
  • Terminal Cheatsheet for Mac
Powered by GitBook
On this page
  • Up-to-the-Minute Dates and Times
  • SQLite
  • MS SQL
  • MySQL
  • Oracle and PostgreSQL
  • Calculating Dates
  • Formatting Dates

Was this helpful?

  1. sql

date-and-time

Up-to-the-Minute Dates and Times

SQLite

To get the current date use: DATE("now")

To get the current time use: TIME("now")

To get the current date time: DATETIME("NOW")

MS SQL

To get the current date use: CONVERT(date, GETDATE())

To get the current time use: CONVERT(time, GETDATE())

To get the current date time: GETDATE()

MySQL

To get the current date use: CURDATE()

To get the current time use: CURTIME()

To get the current date time: NOW()

Oracle and PostgreSQL

To get the current date use: CURRENT_DATE

To get the current time use: CURRENT_TIME

To get the current date time: CURRENT_TIMESTAMP

Calculating Dates

See documentation sites:

Formatting Dates

See documentation sites:

PrevioussqlNextOrdering Columns

Last updated 5 years ago

Was this helpful?

SQLite
MS SQL
PostgreSQL
MySQL
Oracle
SQLite
MS SQL
PostgreSQL
MySQL
Oracle