Reference > Functions > Date and Time
Current_Timestamp
- 2005
- 2008
- 2012
- 2014
- 2016
- 2017
- 2019
- 2022
- 2005, 2008, 2012, 2014, 2016, 2017, 2019, 2022
Current_Timestamp Date and Time Function
Use the Current_Timestamp
function to return the server's current date and time.
Microsoft SQL Server does not require a FROM clause to execute the Current_Timestamp
function, but dbExpression requires a FROM clause to execute any query. For this function to execute on it's own, a "dummy" FROM clause must be provided.
Syntax
db.fx.Current_Timestamp
Arguments
(none)
Returns
DateTime
Examples
Select Statement
Select the server's current date and time.
DateTime current = db.SelectOne(
db.fx.Current_Timestamp
)
.From(dbo.Purchase) // <- "dummy" from clause
.Execute();