Questions tagged [to-timestamp]

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

35 questions
16
votes
10 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
  • 161
  • 1
  • 1
  • 3
3
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…
manuch100
  • 181
  • 2
  • 15
3
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,897
  • 7
  • 41
  • 58
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
0 answers

Optimize TO_TIMESTAMP() query within Oracle

every time I execute this query it takes like 2 minutes to execute: select * from CPOB_Monitoring_Dashboard where VOYAGE_STRT_DT >= TO_TIMESTAMP('2014-07-03 00:00:00.000','YYYY-MM-DD HH24:MI:SS.FF') and VOYAGE_STRT_DT <=…
AlexGH
  • 2,735
  • 5
  • 43
  • 76
1
vote
1 answer

to_timesamp converting month to different month

Any idea why snowflake to_timestamp is converting February month to January? SELECT to_timestamp(to_char('2022-02-02 08:01:29 AM'),'YYYY-MM-DD HH12:MM:SS AM'); -- 2022-01-02 08:00:29.000
1
vote
1 answer

PySpark Use regex function to fix timestamp column

Using PySpark, I've got a string which looks like: +-------------------------+ |2022-12-07050641 | +-------------------------+ But need it to be in this format: +-------------------------+ |2022-11-11 08:48:00.707 …
RiyaadK
  • 11
  • 1
1
vote
2 answers

pyspark to_timestamp() handling format of miliseconds SSS

I have distorted Data, I am using below function here. to_timestamp("col","yyyy-MM-dd'T'hh:mm:ss.SSS'Z'") Data: time | OUTPUT | IDEAL 2022-06-16T07:01:25.346Z | 2022-06-16T07:01:25.346+0000 |…
lil-wolf
  • 372
  • 2
  • 15
1
vote
1 answer

Validate Date strict to format - more than 4 character for year - pySpark

I am trying to validate date received in file against configured date format(using to_timestamp /to_date). schema = StructType([ \ StructField("date",StringType(),True), \ StructField("active", StringType(), True) ]) input_data = [ …
1
vote
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…
NAMAN GUPTA
  • 71
  • 2
  • 12
1
vote
1 answer

to_timestamp() function in spark is giving null values

So I read a csv file with schema: mySchema = StructType([StructField("StartTime", StringType(), True), StructField("EndTime", StringType(), True)]) data = spark.read.load('/mnt/Experiments/Bilal/myData.csv', format='csv',…
Bilal Shafqat
  • 689
  • 2
  • 14
  • 26
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,274
  • 2
  • 18
  • 48
1
vote
2 answers

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…
FergmanTN
  • 41
  • 1
  • 5
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
  • 630
  • 4
  • 13
  • 28
0
votes
0 answers

Why do I get an exception of type 'Oracle.ManagedDataAccess.Client.OracleException' when I use TO_TIMESTAMP?

I have a form that filters/sorts data from a database and displays it in a useful format. The user is suppose to enter a date range (using 2 datetimepickers, they select a start and end date for the search) and a product model to narrow down the…
Zay
  • 11
  • 4
1
2 3