Need to pass CURRENT_TIMESTAMP with execute()
See original GitHub issueHow can I pass CURRENT_TIMESTAMP
when using .execute()? I need the current timestamp with no timezone offset; the data in my DB is stored in local time (not UTC) with no timezone. I can use new Date()
and remove the offset, but node-mssql still constructs the date with an offset of +00:00 that looks like this:
2019-02-27 09:14:31.6660000 +00:00
Additionally, I would prefer to use CURRENT_TIMESTAMP
so that SQL Server evaluates the date on its own at execution time. Sending a timestamp from JS could potentially cause a slightly incorrect date if there is any delay in executing the stored procedure.
Software versions
- NodeJS: 10.15.1
- node-mssql: 4.3.2
- SQL Server: 2016
Issue Analytics
- State:
- Created 5 years ago
- Comments:16
Top Results From Across the Web
Need to get current timestamp in Java - Stack Overflow
java.util.Date date = new java.util.Date(); System.out.println(new Timestamp(date.getTime()));.
Read more >How to get current timestamps in Java - Mkyong.com
This article shows few Java examples to get the current date time or timestamp in Java. (Updated with Java 8). Code snippets
Read more >CURRENT TIMESTAMP special register - IBM
The CURRENT TIMESTAMP (or CURRENT_TIMESTAMP) special register specifies a timestamp that is based on a reading of the time-of-day clock when the SQL...
Read more >SQL Commands to check current Date and Time (Timestamp ...
This article explores different SQL Commands (functions) to return the current Date and Time (Timestamp) in SQL Server.
Read more >Passing timestamp as parameter in a procedure — oracle-tech
Hi All, I want to pass timestamp as paramter to a procedure ..when i try to execute it and give time stamp as...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@GridTrekkor Parameters are here to pass values, not keywords. It just doesn’t feel right to do that.
OK - I’d like to wait to hear from @patriksimek about this, but it may be that we need to modify the datetime Type to allow
current_timestamp
as an allowed value which is then passed through literally…For now, I suspect it just is not possible.