Questions tagged [sql-timestamp]

263 questions
0
votes
2 answers

Select record where a number timestamp is in between 2 java dates

I want to select in SQL a record from my oracle table based on a fromDate and toDate variables. I'm having troubles with the where clause because the TIMESTMP column is declared : CREATE TABLE SCHEMA.LOGGING_EVENT ( TIMESTMP …
user2298581
  • 532
  • 3
  • 11
  • 37
0
votes
1 answer

Trying to create a TIMESTAMP type, the NOW() function is not working on my Azure DATA studio

CREATE TABLE comments ( content VARCHAR(100), created_at TIMESTAMP DEFAULT NOW() ); The error message 'NOW' is not a recognized built-in function name.
0
votes
4 answers

Get last 7 days data from today 7am to last 7 days 7am

I have a query that currently can view the timestamp between yesterday 7am and today 7am data. How do I extract the timestamp of last 7 day timestamp. For example, if today is 10th August 2022, I would like to see the data of 3rd August 7am to 10th…
Sriram
  • 433
  • 4
  • 20
0
votes
1 answer

The use of timestamp in SSMS

I'm using Microsoft SQL Server Management Studio. I am trying to create this database, but I can not figure out what I'm doing wrong with the timestamp; it has to default now. This is the Create Table query: create table users( id int identity…
0
votes
0 answers

Hi All, facing an issue of spark sql query for delete on basis of timestamp

I am running the delete query with the < (less then) and > (greater then) condition on the timestamp field but we are not getting the desired results. Firstly I ran below select query on databricks Query: select * from edl.defectTesting_2_0_0 where…
0
votes
0 answers

MySQL secondary index of timestamp type misses data

Mysql version is 5.1.46. And the table looks like CREATE TABLE `user` ( `id` int(11) NOT NULL AUTO_INCREMENT, `createTime` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`), KEY `index_createTime` (`createTime`) )…
Sin Chang
  • 21
  • 3
0
votes
1 answer

How to convert a string which contains date into a mysql timestamp format?

I am working in python environment. I have a date string which is like this - 26 Apr 2022 17:23:17 GMT I want to insert this date into mysql where the date column datatype is timestamp. How can I achieve this? My variables are like this (id=1,…
0
votes
2 answers

How to convert this timestamp in PLSQL?

Using PL/SQL I have a TIMESTAMP(6) like this: 21-APR-22 02.25.00.000000 PM. I need to convert it to format YYYY-MM-DD HH24:MI:SS (EX: 2022-04-21 14:25:00). EDIT: I also need to store it as a VARCHAR declare ts TIMESTAMP(6) :='21-APR-22…
Schwab
  • 1
  • 1
0
votes
2 answers

Right way to save timestamps to database in laravel?

As part of a standard laravel application with a vuejs and axios front-end, when I try to save an ISO8601 value to the action_at field, I get an exception. class Thing extends Model { protected $table = 'things'; // timestamp columns in…
0
votes
0 answers

Compare Hex unix epoch timestamp strings in SQL

I have a table where I have 2 fields that represent unix epoch timestamp hex example "62508501", "624F645F". They are strings data type. I want to be able to compare the 2 timestamps. Can I straight up compare these string: ts1_hex_string > …
PrueWho
  • 53
  • 4
0
votes
0 answers

AWS-RDS MSSQL: timestamp for getdate() is wrong: offset by 1 hour even with timezone set as UTC

I have a production RDS instance which is showing an incorrect timestamp. The "UTC" time is off by an hour if I look at it with timezone. See the query output below: proddb1> SELECT GETUTCDATE() AS getutcdate, GETDATE() AS getdate, …
cybertoast
  • 1,343
  • 13
  • 19
0
votes
1 answer

Web logs timestamp import to Oracle SQL

I have some web logs that I'm trying to import into Oracle SQL table. The table has timestamp and varchar for when request was made and url. I formatted the logs to looks like this: "Nov 1 2021 2:12:54.856 CDT","/webfolder1/file.html" "Dec 11 2021…
dkgcb
  • 81
  • 1
  • 2
  • 9
0
votes
1 answer

MySQL FIFO policy based on table size

I have a table in MySQL where arrive continuously data (these data have a timestamp). I'd like to create a FIFO Queue based on the size of the table. I mean, if I set for example 1GB as threshold and the data begin to be stored once I reach 1 GB of…
0
votes
1 answer

How to subtract two timestamps in SQL and then count?

I want to basically find out how many users paid within 15 mins, 30 mins and 60 mins of my payment_time and trigger_time I have the following query with redshift_direct() as conn: trigger_time_1 = pd.read_sql(f""" with…
coder_bg
  • 340
  • 6
  • 20
0
votes
2 answers

Filter a scala dataset on a Option[timestamp] column to return dates that are within n days of current date

Lets say I have the following dataset called customers lastVisit id 2018-08-08 12:23:43.234 11 2021-12-08 14:13:45.4 12 And the lastVisit field is of type Option[Timestamp] I want to be able to perform the following... val…
user10313137