cannot seem to get datetime working -
i have problems getting date work,
@{ var today = datetime.today .tostring("ddmmyyyy"); var db = database.open ("assignment_fanclub"); var locations = "select * events date =" + today; var select = database.query (locations); var pushpins = new list <maps.maplocation>(); }
any suggestions ?
if want records today, 1 possibility use date/time in database server rather application. makes sense, because time set on server.
the exact syntax depends on database. ansi standard syntax is:
select * events date = cast(current_timestamp date)
other reasonable syntaxes are:
mysql:
select * events date = curdate()
sql server:
select * events date = cast(getdate() date)
postgres
select * events date = date_trunc('day', current_timestamp)
oracle:
select * events date = trunc(sysdate)
Comments
Post a Comment