postgresql - How to handle timestamp with timezone on postgres with knex.js -


i trying translate following sql query knex:

select count(*) finished_on_time task_history   date = 20160303         , store_id = 2         , (schedule_start_time @ time zone 'australia/sydney' + interval '1' minute * floor (group_duration) )::time >= (finish_time @ time zone 'australia/sydney')::time 
  • date field has in yyyymmdd format

here have been trying on knex:

db.table('task_history') .count('*') .where({date: request.params.storeid, store_id: request.params.storeid })  ?????? 

as can guess, not sure clause use handle sql syntax [at time zone australia/sydney].

i have been trying find similar soloutions on internet, ended here.

http://knexjs.org/#builder-whereraw

db.table('task_history')     .count('*')     .where({date: request.params.storeid, store_id: request.params.storeid })     .whereraw("(schedule_start_time @ time zone 'australia/sydney' + interval '1' minute * floor (group_duration) )::time >= (finish_time @ time zone 'australia/sydney')::time") 

Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -