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
0
votes
3 answers

PLSQL Replace Hours in a date

I want to replace the hour on a date, for instance, if I have 07/07/13 11:15, I'll want to get 07/07/13 00:00 from the first date. So, what I'm trying to do is this: textDate := TO_CHAR (auxDate, 'DD/MM/RR')||' '||textHour||':'||textMin; endDate :=…
mdlapla
  • 37
  • 10
0
votes
1 answer

ORA-00900: invalid SQL statement on to_date in oracle

I get an error in a INSERT. The problem is in this line: to_date('05-JUN-13 01.09.10.000000 PM','DD-MON-YY HH.MI.SS.FF') I don't know how resolve it. I tried also with to_timestamp('05-JUN-13 01.09.10.000000 PM','DD-MON-YY HH.MI.SS.FF') But i…
Atlas91
  • 5,754
  • 17
  • 69
  • 141
0
votes
2 answers

to_char and to_date are returning different output

I am using below queries. select sysdate from dual where to_char(sysdate,'DD-MM-YY')='28-MAY-13'; and the output is null. But for below query, output is current date. select sysdate from dual where to_date(sysdate,'DD-MM-YY')=…
Samurai
  • 843
  • 6
  • 23
  • 44
0
votes
1 answer

convert date in sql using to_char function

I would like to convert the following date to this format(DD-MON-YYYY). I tried executing the below query but I got the error saying "date format not recognised". select to_char(to_date('Sat Dec 01 00:00:00 IST 2012','EEE Mon dd HH:mm:ss z…
Raul
  • 139
  • 1
  • 6
  • 17
0
votes
2 answers

SQL Developer: Invalid Relational Operator Error, also formatting questions

I am trying to add some formatted columns to a query to our db, but I think I'm getting the operators wrong in my CASE statement. I'm also unclear on how to write formatting for the TO_CHAR operation. Is it the same as for the TO_DATE operation?…
Alex Ackroyd
  • 1
  • 1
  • 1
0
votes
1 answer

i had a trouble with Oracle SQL exercise

I had the follow instruction on Oracle SQL: SELECT TO_DATE(FE_DAY || '/' || FE_MO || '/' || FE_YEAR, 'dd/mm/yyyy') FROM TI_DATE WHERE FE_DAY =15 BETWEEN TO_DATE('01/01/2011') AND TO_DATE('31/12/2012') and effectively I get all the dates that…
Christian Magro
  • 139
  • 1
  • 1
  • 11
0
votes
2 answers

How to insert into table where variable -1

I'm having problems while trying to insert into a table by selecting from another table with the dates as a condition. The date will be retrieved from another table and not from Oracle, because the application stores its own system date (i.e. today…
feef24
  • 1
  • 1
0
votes
4 answers

oracle between clause inclusive format HH24:MI

My query looks something like: select * from mytable where date_field between to_date(#from#, 'YYYY/MM/DD HH24:MI') and to_date(#to#, 'YYYY/MM/DD HH24:MI') As an example: if from = 2012/07/18 00:00 and to = 2012/07/18 00:09 will this…
iyerland
  • 632
  • 2
  • 10
  • 24
0
votes
1 answer

to_date function issue in PostgreSQL

I have a PostgreSQL table with a column name date_stamp and its data type is "date". I need to execute the below query and it's not working. Can anyone help? Thank You. (I am using PHP) $DS = date('d m Y' ,$data['time_stamp']); $query =…
Les_Salantes
  • 317
  • 6
  • 20
0
votes
1 answer

trying to concat a couple of TO_DATE(SUBSTR) to get a combined date of 'dd-mon-yyyy' from strings..?

I previously ask about converting strings to dates and formatting them.. split string based on character position in ORACLE 11g SQL Here is the solution I have come up with where WKENDING is VARCHAR2 and RYEAR is date The WKENDING has data that…
SeattleGray
  • 95
  • 1
  • 3
  • 10
0
votes
2 answers

html output in plsql - date not proper

I am trying to extract the below query: select ''||column1||'', ''||column2||'', ''||column3||'' from table In the above, column3 is a date field. When the output is printed, it is ignoring the time part. For…
Kannan Lg
  • 911
  • 4
  • 11
  • 21
0
votes
2 answers

Split date field into time and day Oracle

I have a table TIME_TABLE on Oracle 10.6. There is a field called Start_Date on this table. Item Start_Date 1 3/13/2012 8:00:00 AM 2 4/2/2012 1:30:31 PM I want to take only time information from Start_Date field like that,…
cadyT
  • 77
  • 1
  • 3
  • 9
-1
votes
1 answer

am tring to get weekdays from given timestamp rquired to use to_date but returns null

Hi i'm trying to get weekday from timestamp with am pm. so I have a dataframe dataframe = spark.createDataFrame( data = [ ("1","9/8/2019 10:01:28 PM")], schema=["id","input_timestamp"]) dataframe.show() dataframe.printSchema() And…
GLADOS
  • 33
  • 3
-1
votes
1 answer

SQL "TO_DATE" fuction seems weird

Quick question about the function "TO_DATE" in SQL_DEVELOPER who looks weird. I need to do an SQL query to make an dashboard after and for that, I need to change date to be more understandier for other people. So i've got a column called: DT_EXP_C…
Onyx
  • 35
  • 6
-1
votes
1 answer

Use converted date in Where clause using dynamic date statements

I have successfully converted a date stored as varchar to a valid date, and now need to use it in a dynamic date statement in my Where clause. Unfortunately, I keep getting errors, or no returns. The code below runs but I get no returns, if I put…