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
votes
2 answers

error ORA-01841: (full) year must be between -4713 and +9999, and not be 0 while loading data using yyyymmdd format

Below statement throws an error on 11-Jan-2019 we check the value of paydate as 20190111 and it is correct from source. but still, the code throws an error. ORA-01841: (full) year must be between -4713 and +9999, and not be 0 INSERT INTO…
Pratik Mokal
  • 1
  • 1
  • 3
-1
votes
3 answers

Convert string to datetime in Excel with individual format parameter (like TO_DATE, DateTime.ParseExact)?

Is there a function that converts a string to datetime using datetime format that is given as parameter in Excel? You can imagine this like functions below in different platforms: PLSQL: TO_DATE("20191301","YYYYDDMM") C#:…
Ali Tor
  • 2,772
  • 2
  • 27
  • 58
-1
votes
2 answers

Extract Date with a Timestamp with timezone

How do I convert the following timestamps to a simple date? Thu Nov 29 18:00:00 CST 2018 Thu Apr 26 01:00:00 BST 2018
Divya Rao
  • 7
  • 2
-1
votes
4 answers

to_date not working in sql server 2008

I am getting an error and I am using SQL Server 2008 select * from where rd_date between to_date('2018-17-05 00:00:00') and to_date('2018-06-06 00:00:00') When I execute, I am getting the below error Msg 195, Level 15, State 10, Line 68…
MSM
  • 327
  • 2
  • 6
  • 12
-1
votes
1 answer

date format error in to_date

I trying to run this query : SELECT to_date(substr( "SCC_STG_DIM_OVERWRITE_FNL"."TERM_END_DT" , 1, 19), 'yyyy.mm.dd hh24:mi:ss.aaaaaaaaa') FROM ("EDMWHS"."SERVICE_CONTRACT"…
Pratik Fouzdar
  • 29
  • 1
  • 2
  • 7
-1
votes
1 answer

Oracle PL/SQL: Convert number to words without using to_date

Is there a simple alternative to using to_date function to convert numbers to words in Oracle using PL/SQL like 0 -> Zero, 1->One, 2->Two etc I researched a lot and found the below popular statement but I have a requirement to do the same without…
-1
votes
2 answers

Using SQL Statement in TO_DATE Function?

I have to use SQL statement in TO_DATE function. Like: TO_DATE((select MAX(VERSION) from TABLE_B),'MM/DD/YYYY') When I use TO_DATE like that, I encounter an error. Like: [Error] Execution (9: 32): ORA-01858: a non-numeric character was found where…
Iyshe
  • 3
  • 1
  • 4
-1
votes
2 answers

change DD-MMM-YYYY to YYYYMMDD in oracle

i have a date 07-OCT-2017, I have to get it converted as 20171007 in oracle. Below code doesn't work for me select To_date(to_char('07-OCT-2017','DD-MMM-YYYY'), 'yyyymmdd') from dual;
user2814847
  • 35
  • 1
  • 7
-1
votes
1 answer

DATE Manipulation

I would appreciate any pointers with this, I'm trying to ultimately get the Day of the week for each date. Unfortunately my DATESTRG in format 02-JUL-13 is ending up as 13/07/0002 rather than 02-07-2013 ( European date format ), and I get an error…
Gavin
  • 147
  • 2
  • 3
  • 13
-1
votes
1 answer

Drill Casting to date gives wrong values

I have started using Drill date conversion function and read this link So i was trying to imlement TO_DATE(, ) I wrote this query: SELECT DRILL_TABLE_214.date_id , (DRILL_TABLE_214.date_id / 100) dup_by_100, …
2Big2BeSmall
  • 1,348
  • 3
  • 20
  • 40
-1
votes
2 answers

Extract Month in sql and adding 1

If I add 1 to extract(month from date), then does the result become 13 or 1 (January of next year) I have the below code: (extract(day from sysdate) >=1 and extract(month from sysdate)=12) and (targstartdate >= to_date(((extract(month from…
Jicar Jhon
  • 11
  • 1
-1
votes
2 answers

Error when using TO_DATE in SQL

I understand the basic TO_DATE usage in Oracle SQL. i google and found some guides to use TO_DATE which is to convert julien date to normal date. the basic working code is : SELECT TO_CHAR((TO_DATE(2016365, 'YYYYDDD'))) FROM DUAL) However, i want…
B.Dick
  • 305
  • 2
  • 11
-1
votes
1 answer

To_CHAR(SYSDATE, ...) ----> TO_DATE

So i have this code : create or replace TRIGGER tr_after_logon AFTER LOGON ON SCHEMA DECLARE var_date VARCHAR(20); BEGIN SELECT TO_CHAR(SYSDATE, 'DD:MM:YYYY HH24:MI:SS') INTO var_date FROM DUAL ; INSERT INTO activity_log (numero,…
-1
votes
2 answers

casting timestamp as date oracle

I have this Timestamp field which looks like this: 2015-08-24 16:24:28.763915 and I want to get only the date and insert to date field I tried this: select TO_DATE(CAST (CON1.AF_UPDATE_DT AS VARCHAR(10)), DD/MM/YYYY) FROM AF_EMR_MEM_CONT CON1 but i…
YossiH
  • 17
  • 5
-1
votes
1 answer

Converting to time in Oracle

I have a table in oracle 'punch' where punching data is stored. 'punchtime' column is having the data as varchar2 and time is stored(like 20:30:00). when i want to sort the data by punchtime I use this query select * from punch order by…
Shanna
  • 753
  • 4
  • 14
  • 34
1 2 3
19
20