Questions tagged [to-date]

to_date is sql function that converts string to date

to_date is an SQL function that converts a string to a date.

Reference

293 questions
1
vote
3 answers

to_date unable to print timestamp

I want to print the timestamp from the below sql select to_date('01/01/2011 12:00:00 AM','dd/mm/yyyy hh:mi:ss AM') from dual; current output --> 1/1/2011 (not printing the timestamp only for 12 am. if the min is 12:01 then it is printing. but I…
user1090616
  • 11
  • 1
  • 2
1
vote
2 answers

databricks string to timestamp "January 1, 2022 12:00:00 AM"

New to databricks, loaded a table which has a column of string type with values such as "January 1, 2022 12:00:00 AM" and need to convert it to a timestamp. Any suggestions? I've tried a bunch of SQL date functions but they either fail or return…
1
vote
1 answer

Has many through query using the date

I am trying to use the value from a has_many :through relationship to retrieve a list of Authors but my logic is failing. What would be the best way to achieve this Currently trying this without success start_date =…
bubbaspaarx
  • 616
  • 4
  • 15
1
vote
1 answer

Data Studio "Date Range Control" doesn't working when date column with empty values

I have two different DateTime columns with the same format date. "Created_datetime" is well recognized by data studio as a date). "paid_datetime" will contain some empty value, Data Studio does not recognize it as date but as text. Data table shown…
Andy Hui
  • 420
  • 2
  • 6
  • 17
1
vote
0 answers

Convert a varchar column to date for the month of December

I have a varchar2 column in a table which saves dates in it with the format mask 'DD-MON-RR'. Now when I try to convert it with {to_date(my_field,'DD-MON-RR')} it returns accurate result except when I convert the December month, it throws an…
1
vote
3 answers

Getting not valid month in Oracle sql

I have a table called Transactions that has a column called trans_date. I am just trying to do a simple query in the SQL*Plus command window The query is SELECT * FROM transactions WHERE trans_date BETWEEN to_date('09/11/2021','mm/dd/yyyy') AND…
1
vote
1 answer

Azure data flow string to date conversion in formate

My source is CSV contains enddate & startdate column datype string. I need to change those date columns in destination table format. source - Destination : SALES_ORGANIZATION STARTDATE ENDDATE EXTRACT_MNTS AE93-AE-CS 2020-01-01 2020-12-31 …
anuj
  • 124
  • 2
  • 13
1
vote
1 answer

Incorrect nvarchar to date conversion in oracle

I am trying to insert data having datatype as nvarchar to a column having data type as date and oracle is doing the conversion wrongly. I tried couple of things and it isn't working. Could some please suggest an alternative. I am using oracle…
Aswin Ajai
  • 11
  • 2
1
vote
1 answer

Convert date to another format Scala Spark

I am reading a CSV that contains two types of date: dd-MMM-yyyy hh:mm:ss -> 13-Dec-2019 17:10:00 dd/MM/yyyy hh:mm -> 11/02/2020 17:33 I am trying to transform all dates of the first type into the second type but I can't find a good solution. I am…
MLstudent
  • 89
  • 6
1
vote
1 answer

Mongo converting timestamp to date

Im still new in mongo but i have a data in mongo collection that is structured like this : { "_id" : ObjectId("5f79931104a8f102f761398e"), "data1" : "This is a data", "data2" : "This is a data", "timeStampVar" : Timestamp(1603377200,…
1
vote
4 answers

In snowflake , how to convert one date format to another format. From YYYYMMDD to YYYY-MON-DD

I have table ABC in which I have column Z of datatype Date. The format of the data is YYYYMMDD. Now I am looking to convert the above format to YYYY-MON-DD format. Can someone help?
1
vote
1 answer

Convert string to date with added time Oracle

I have two values I want to compare. Samples of those are the following: '01/04/2020T07.08.45' '2020-04-01 14:46' I want to transform the first value into the same mask as the second, so I can use it to join two tables lateron. The first value…
Sunfile
  • 101
  • 1
  • 4
  • 22
1
vote
2 answers

Redshift can't convert a string to a date, tried multiple functions

I have a table with a field called ADATE, it is a VARCHAR(16) and the values are like so: 2019-10-22-09:00. I am trying to convert this do a DATE type but cannot get this to work. I have tried: 1 TO_DATE(ADATE, 'YYYY-MM-DD') Can't cast database…
Matt
  • 14,906
  • 27
  • 99
  • 149
1
vote
3 answers

Ora-01821 date format not recognized

I want to change the string into date field but I received the error ora- 01821 date format not recognized while executing the following query.also I need am/pm in the db .how to achieve that update bucket set closed = to_date(closed_on,'dd-mon-yy…
Chelseia
  • 11
  • 2
1
vote
1 answer

My time data "does not match format". How to properly format my datetime?

I'm using a pandas dataframe, in which I wish to format one column to be datetime objects. The "object" strings look like this: 2009-01-01T00:00:01+02:00 I have tried to format the column with to_datetime(dataset["Datetime"], format = "%Y/%m/%d T…
Zygos
  • 61
  • 5