firebird

Select current date


I am new to Firebird. I come from a SQL Server background.

To get current date I use following query in SQL Server

SELECT GETDATE()

I am looking for something similar in Firebird


Solution

  • select 'Now' from rdb$database
    -- returns 'Now'
    select cast('Now' as date) from rdb$database
    -- returns e.g. 2008-08-13
    select cast('now' as time) from rdb$database
    -- returns e.g. 14:20:19.6170
    select cast('NOW' as timestamp) from rdb$database
    -- returns e.g. 2008-08-13 14:20:19.6170
    

    Shorthand syntax for the last three statements:

    select date 'Now' from rdb$database
    select time 'now' from rdb$database
    select timestamp 'NOW' from rdb$database