Questions tagged [to-timestamp]

This function generally used to get timestamp from miliseconds, date, timeuuid or other timely objects.

23 questions
12
votes
9 answers

Convert text to timestamp in redshift

I have a text field "presence_changed_at" with text values i.e. '2014/12/17 08:05:28 +0000. I need to convert this into timestamp. In postgreSQL there is function TO_TIMESTAMP(), however in redshift this does not seem to be supported. I can get the…
user5157294
  • 121
  • 1
  • 1
  • 3
2
votes
2 answers

Postgres to_timestamp function

I have a python script that insert hourly readings into a postgres db. It is failing in 2010-03-28. How is postgres interpreting both 01:00:00 and 02:00:00 as 02:00:00. what am I doing wrong (ps: works for other dates prior to this) select…
Leo Taylor
  • 21
  • 1
2
votes
3 answers

ERROR: invalid value for "MI" Detail: Value must be an integer

In PostgreSQL, I got an error for the following request: SELECT TO_TIMESTAMP('2020-03-07T22:34:18Z', 'YYYY-MM-DDTHH24:MI:SSZ'); which yielded: ERROR: invalid value ":1" for "MI" Detail: Value must be an integer. Why there would be an error…
2
votes
1 answer

Oracle timestamp with timezone in where clause issue

I have the following sql query with select * from MY_TABLE MY_COL >= to_timestamp_tz('08-03-17 07:25:00.0000 EST', 'dd-mm-yy hh24:mi:ss.ff TZR') and MY_COL <= to_timestamp_tz('08-03-17 09:08:00.0000 EST', 'dd-mm-yy hh24:mi:ss.ff TZR') Where…
Pradyot
  • 2,349
  • 7
  • 35
  • 49
1
vote
1 answer

Compare a character varying with a timestamp

I'm trying to compare a character varying with a timestamp in postgresSQL. I want to get all the values that are before current time compared to the character varying timestamp. Would this compare correctly? WHERE…
jrocc
  • 1,026
  • 1
  • 12
  • 39
1
vote
1 answer

Converting Teradata Timestamp to Epoch

A version of this question has been asked and answered a couple of years ago: Timestamp to epoch conversion in teradata. However, there is a comment in one of the answers that leads me to believe that there is possibly a new way to solve this…
1
vote
1 answer

How to pass string variable inside to_timestamp() in oracle

I have a query like this: select from_tz(to_timestamp(v_time,'YY-MM-DD HH24:MI:SS'), 'UTC') at time zone 'America/New_York' from dual; If I use a string Date instead of v_time then it works fine. But I need to pass a variable v_time inside…
Novis
  • 552
  • 3
  • 11
  • 27
0
votes
1 answer

Convert a date from UTC timezone to PST Time zone (including DST factor)

I want to convert a date in UTC timezone to PST timezone. The NEW_TIME doesn't take into account the DST (Daylight Saving Time) factor, so I tried using CAST and TO_TIMESTAMP_TZ functions but both gave incorrect time ( difference of around 5 hrs 30…
0
votes
1 answer

Postgres to_timestamp setting timezone to +1

I am using the to_timestamp function in Postgres to convert an integer value to a timestamp. When I do this, the timezone is set to +1, adding an hour to the stored time. I am located in the UK so the current timezone offset should be +0, not…
user14131782
  • 213
  • 1
  • 12
0
votes
1 answer

Snowflake Timestamp column not loaded using Copy Command

I am using Copy command to load a file in table. It has a timestamp column. In my File format I have defined Timestamp as other and gave value as MM/DD/YYYY HH:MI:SS AM to match with data. When I execute it loads all records which have timestamp…
0
votes
1 answer

Oracle Date formatting 9999-06-15T00:00:00.000+0000 in 12c

I have got a date coming from the webservice in 9999-06-15T00:00:00.000+0000 format. How do i save this into the date column of a table in Oracle 12c DB. I have tried select to_date('9999-06-15T00:00:00.000+0000', 'YYYY-MM-DDTHH24:MI:SS.fff+0000') …
Girish
  • 63
  • 2
  • 11
0
votes
1 answer

String to Timestamp Pyspark / Spark

I have requirement to convert a input string 08-DEC-2011 00.00.00 to timestamp 20111208000000 - The data in the file. "CLIENTCONTEXTID","SRVR","CLNT","USERNAME","UPDATEDTM" 1202,"jbosswabcd6","100.126.164.172","SUSER",08-DEC-2011…
Rafa
  • 213
  • 2
  • 11
0
votes
2 answers

Timestamp validation in pyspark

We are building a data ingestion framework in pyspark and trying to handle timestamp exception. Basically, want to have a reject record in separate column that does not confirm to the schema. df = spark.createDataFrame( [ ("1988-06-15…
0
votes
2 answers

null values not processed by to_timestamp in oracle sql

I'm trying to load data from a csv with sql-loader. There's one column with date in this format: 2011-12-31 00:00:00.000 I tried it using to_date() but it couldn't handle fractions of second. Therefore I used…
havaey
  • 9
  • 4
0
votes
1 answer

How to calculate the arithmetic mean of time oracle?

I have a table in Oracle with the time value in the column, but the column type is nvarchar2, the time format is 0:21:31, how can I calculate the average value i.e. (0: 22: 00 + 0: 24: 00) = 0 : 23: 00
DromiX
  • 321
  • 1
  • 2
  • 11
1
2