Questions tagged [sql-timestamp]

263 questions
71
votes
2 answers

Oracle SQL : timestamps in where clause

I need to look up rows within a particular time frame. select * from TableA where startdate >= '12-01-2012 21:24:00' and startdate <= '12-01-2012 21:25:33' I.e.: I need to look up rows with timestamp precision of SECONDS. How do I achieve…
sid
  • 895
  • 3
  • 10
  • 14
18
votes
5 answers

MySQL 1292 Incorrect datetime value

I am getting this error when I try to insert '2011/03/13 02:53:50.000000000' into a timestamp column. If I change the 13 to a 15, 14, 12 or 11 it works no problem. I've also tried changing the /'s to -'s and still no-go. I've looked through some…
CycleGeek
  • 473
  • 2
  • 6
  • 14
18
votes
4 answers

Oracle SQL: converting timestamp to UTC

I have a simple select query such as below but I noticed I am getting back the regional times. How can I convert to UTC in my select statment? select myTimeStamp, MyName, MyBranch from tableA Result: '27/03/2014 15:15:26' 'john', 'london' I have…
Fearghal
  • 10,569
  • 17
  • 55
  • 97
17
votes
3 answers

How to convert TIMESTAMP values to VARCHAR in T-SQL as SSMS does?

I am trying to convert a TIMESTAMP field in a table to a string so that it can be printed or executed as part of dynamic SQL. SSMS is able to do it, so there must be a built-in method to do it. However, I can't get it to work using T-SQL. The…
Neo
  • 4,145
  • 6
  • 53
  • 76
15
votes
4 answers

Hive - month and year from timestamp column

Hi I am trying to extract the month and year part of a timestamp column in hive using the below query select from_unixtime(unix_timestamp(upd_gmt_ts,'yyyyMM')) from abc.test; The output looks like 2016-05-20 01:08:48 the desired output should be…
keeplearning
  • 369
  • 2
  • 6
  • 17
15
votes
2 answers

Timestamp conversion in Oracle for YYYY-MM-DD HH:MM:SS format

I'm trying to insert records with YYYY-MM-DD HH:MM:SS format into Oracle from Netezza, but I'm getting invalid date type. How can I accomplish this one? CREATE TABLE AM_PROGRAM_TUNING_EVENT_TMP1 ( ST TIMESTAMP, ET TIMESTAMP, MAS_DIV_KEY…
Teja
  • 13,214
  • 36
  • 93
  • 155
14
votes
2 answers

How to implement created_at and updated_at column using Room Persistence ORM tools in android

How can I implement created_at and updated_at columns using Room Persistence ORM tools in Android, that can update the timestamp automatically when creating or updating a row in a table?
13
votes
7 answers

How do I make doctrine support timestamp columns?

I'm trying to apply the following migration: Schema::table('users', function (Blueprint $table) { $table->timestamp('created_at')->useCurrent()->change(); }); But artisan says: [Doctrine\DBAL\DBALException] Unknown column type "timestamp"…
x-yuri
  • 16,722
  • 15
  • 114
  • 161
9
votes
3 answers

Eloquent: Invalid default value with timestamps

Here's my migration schema: public function up() { Schema::create('objects', function (Blueprint $table) { $table->increments('id'); $table->timestamp('timestamp1'); $table->timestamp('timestamp2'); }); } But when I…
JacopoStanchi
  • 1,962
  • 5
  • 33
  • 61
9
votes
1 answer

Select timestamp data for specific time range each day

I have a postgresql table with a column of type timestamp without timezone. Every row increases/decreases by 1 minute eg: 2015-07-28 01:35:00 2015-07-28 01:34:00 2015-07-28 01:33:00 ... ... 2015-07-27 23:59:00 2015-07-27 23:58:00 2015-07-27…
darkpool
  • 13,822
  • 16
  • 54
  • 89
7
votes
2 answers

SqlAlchemy TIMESTAMP 'on update' extra

I am using SqlAlchemy on python3.4.3 to manage a MySQL database. I was creating a table with: from datetime import datetime from sqlalchemy import Column, text, create_engine from sqlalchemy.types import TIMESTAMP from sqlalchemy.dialects.mysql…
Simone Bronzini
  • 1,057
  • 1
  • 12
  • 23
6
votes
3 answers

java.time.Instant field cannot be filled by JPQL query using "current_timestamp" after update to SpringBoot 3 / Hibernate 6

I have a base class for persisted entities like this: @EntityListeners(AuditListener.class) @MappedSuperclass public abstract class BaseEntity { @Id private String id; private Instant createdAt; private String createdBy; private…
6
votes
0 answers

“Time(3)” type on Liquibase with MySQL 8

I'm facing a problem using Liquibase with MySQL 8 where the following script is not putting the fraction part of type "time(3)", it only puts "time" on the type of the column. We run this script before with MySQL 5 and it worked fine.
6
votes
2 answers

Convert special String into Date in H2

There is a SQL function from Oracle to_date('26 Jul 2016, 05:15:58 AM','DD Mon YYYY, HH:MI:SS AM'), and it throws exception "Illegal pattern character 'o'" in H2. How shall I change it to make it work in H2?
Iceglaze
  • 329
  • 2
  • 4
  • 10
5
votes
2 answers

How do I get a list of all the last modified tables in an Oracle database?

select ora_rowscn from table_name; ORA_ROWSCN returns the conservative upper bound system change number (SCN) of the most recent change to the row. This pseudocolumn is useful for determining approximately when a row was last updated. How do I get…
1
2 3
17 18