Questions tagged [sql-timestamp]

263 questions
0
votes
1 answer

SQL showing current timestamp in different formats Mysql

I need to show current UTC timestamp in a format '2021/05/10T18:30:36Z' SELECT UTC_TIMESTAMP() FROM XYZ gives me 2021-05-10 18:30:36 how do i add the / instead of - and use T and Z
Lav
  • 1,283
  • 5
  • 21
  • 48
0
votes
4 answers

How to calculate average of values with the same timestamp in Postgresql?

i have the following table: date value Average 2021-04-07 18:00:00 5 2021-04-07 18:00:00 10 2021-04-07 18:02:00 5 2021-04-07 18:02:00 4 2021-04-07 18:03:00 5 2021-04-07 18:03:00 8 And i want to know how could i calculate…
0
votes
1 answer

Formatting timestamp ntz in Snowflow to output as date time YYYY-MM-DDTHH:MMZ

I have TIMESTAMP NTZ field in Snowflake. I need to output the value of the column in the following format: YYYY-MM-DDTHH:MMZ I tried the following but it didn't work: SELECT to_timestamp_tz(MAX("UPDATED_AT"), 'yyyy-mm-ddTHH:MMZ') FROM HISTORY;
0
votes
3 answers

Snowflake - convert string to datetime

I am using snowflake and I have date as a string in this format '2021-04-01 08:00:05.577209+00' I want to convert it to DateTime. I used the below code to do this (I trim '+00' from each string first). However I think I defined it somehow wrong,…
0
votes
2 answers

How to convert string timestamp into timestamp with a specific timezone

I'm trying to convert string timestamp having timezone in it to a timestamp with the same timezone. However, when executing the below code, I'm getting default system timestamp. Can someone help me on this. Below is the code I'm trying. try { …
heman
  • 67
  • 1
  • 9
0
votes
1 answer

MySQL select after row on specific rules

I have a table like this: CREATE TABLE IF NOT EXISTS `logging` ( `id` int(6) unsigned NOT NULL, `status` varchar(150) NOT NULL, `timestamp` DATETIME NOT NULL, PRIMARY KEY (`id`) ) DEFAULT CHARSET=utf8; INSERT INTO `logging` (`id`, `status`,…
Dian Arief R
  • 69
  • 1
  • 9
0
votes
1 answer

Struggling to extract a specific month of DATE(s) from a Timestamp field in BigQuery SQL

Just started my very first data analyst job this week! My first bigquery is hitting a lot of snags: I need to somehow extract a specific set of dates from a timestamp field. Specifically: I need to extract all of the dates for the month of December,…
0
votes
1 answer

Teradata SQL numeric to timestamp or date

I need to change a column that looks like this =" 202007211330231166 " into time stamp or date format = 21/07/2020 & time = 1:30 pm i.e. (1330 <- part) Help. I was attempting to use Substring to capture the date & time sections. select InfoData from…
J J
  • 1
  • 2
0
votes
2 answers

Problem with Java Timestamp with SQL Date type

In my db table I have a column c_dob of Type date For my controller Request class, I use the above field like this : import java.sql.Timestamp; public class UpdateUserProfileRequest { private Timestamp dob; public Timestamp getDob() { …
arqam
  • 3,582
  • 5
  • 34
  • 69
0
votes
1 answer

Timestamp to date in SQL

Here is what I did: Select count(check_id) From Checks Where timestamp::date > '2012-07-31' Group by 1 Is it right to do it like I did or is there a better way? Should/could I have used the DateDIFF function in my WHERE clause? Something like:…
Diablo
  • 1
  • 2
0
votes
1 answer

Selecting rows with constrained time-stamp differences (in seconds) in tables in SQL

I have a table called visit_times in SQL like this name time_stamp Allen 2015-02-13 07:10:54 Allen 2015-02-13 07:10:58 Allen 2015-02-13 07:11:02 Mary 2015-02-17 10:45:33 Mary 2015-02-17 10:45:39 Mary 2015-02-17…
0
votes
1 answer

Postgres: global setting to always return TIMESTAMPTZ in exactly the same format? i.e.: 6 digits of sub-seconds + 4 digits of timezone offset

Postgres will return TIMESTAMPTZ values using inconsistent formats, depending on how many zeros are after the . See these examples: 2020-10-24 13:21:05+10 2020-10-24 13:21:05.1+10 2020-10-24 13:21:05.12+10 2020-10-24 13:21:05.123+10 2020-10-24…
LaVache
  • 2,372
  • 3
  • 24
  • 38
0
votes
1 answer

How to run the postgres query with date as input on the column with timestamp in long format

I want to query postgres database table which has the column with timestamp in long milliseconds. But I have the time in date format "yyyy-MM-dd HH:mm:ssZ" like this. How can I convert this date format to long milliseconds to run the query?
user3553913
  • 373
  • 3
  • 17
0
votes
2 answers

MISSING COMMA WHILE INSERTING DATE AND TIME

I have this query: INSERT INTO ella (id, tmstmp AS DATE, ändere) VALUES (id 1, DATE 26.08.2020,10:44:33, ändere "Thomas"); but it always show error: missing comma. What do I do wrong? Where else should I put the comma) The table name is Ella. The…
ella widya
  • 15
  • 5
0
votes
5 answers

VARCHAR2 to TIMESTAMP conversion in ORACLE 12c

I have a column in table A as select create_time from table_a; The value is 08-MAR-19 08.23.47.897000000 PM GMT. This column has been marked as VARCHAR2 for some business purpose. Now I am trying to get this column and convert the value to…