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
3
votes
1 answer

Oracle to_date function with codeigniter

I am using Codeigniter to insert data into an Oracle table which contains a date field. Sample code looks like this: $upload_details = array("user_name" = $name, "age" = $age, "date" = 'to_date($date,…
WebNovice
  • 2,230
  • 3
  • 24
  • 40
3
votes
3 answers

dd-mm-yyyy to yyyy-mm-dd SQL

I am working on SQL assignment in my school. There is a problem with DATE for me. There is a query given. INSERT INTO myTable (t_id, Birthdate) VALUES (1, TO_DATE('01-Jun-2005','dd-mm-yyyy')); INSERT INTO myTable (t_id, Birthdate) VALUES (2,…
KC Junior
  • 49
  • 6
3
votes
2 answers

How to convert a float column to datetime with only year and month in Python?

I have a DATE column like this, DATE CÓDIGO ... UNIDADE VALOR 0 2009.06 10000.0 ... NaN NaN 1 2009.06 10100.0 ... NÃO SE APLICA . 2 2009.06 10101.0 ... M2 0.46 3 2009.06 10102.0 …
3
votes
1 answer

Date format in Informix

Is it possible to print the date in the below format in Informix DB, May 19 1993 12:00AM ? Consider the below eg., If I shoot the below query, select sysdate from systables; It displays as, 2017-12-15 05:00:47.24318 But I want the output to be…
Peter.Fox
  • 55
  • 1
  • 1
  • 6
3
votes
1 answer

Oracle DB to_date with year - to_date(2017,'YYYY') unexpected return

While writing few queries I needed to return only those rows that have date column set in this year (2017) , that's not my problem I know how to write this query in couple of diffrent ways, but I came across something strange and unexpected for me.…
3
votes
1 answer

ansi SQL date function in Oracle

I realize I could use a combination of to_char and to_date and what not as a work-around, but I'm trying to figure out why this doesn't work. I am using Oracle 12.1 select '2016-10-01' from dual union all select to_char(2016)||'-10-01' from…
fleetmack
  • 349
  • 1
  • 3
  • 11
3
votes
2 answers

oracle to_date with format doesn't show time

I have simple calculation, I subtract interval from date with time: select TO_DATE('2016-12-05 23:04:59', 'YYYY-MM-DD HH24:MI:SS') - to_dsinterval('00 0:05:00') from dual; It works fine, the result: 2016-12-05 22:59:59 but it doesn't work…
Nikolas
  • 2,322
  • 9
  • 33
  • 55
3
votes
1 answer

PostgreSQL: Insert Date and Time of day in the same field/box?

After performing the following: INSERT INTO times_table (start_time, end_time) VALUES (to_date('2/3/2016 12:05', 'MM/DD/YYYY HH24:MI'), to_date('2/3/2016 15:05', 'MM/DD/YYYY HH24:MI')); PostgreSQL only displays the date. If possible, would I have…
gimmegimme
  • 331
  • 7
  • 20
3
votes
3 answers

TO_CHAR and TO_DATE giving different results.How to achieve the TO_CHAR functionality using TO_DATE?

SELECT TO_CHAR((select logical_date -1 from logical_date where logical_date_type='B'),'DD/MM/YYYY HH24:MI:SS') FROM DUAL; This Query returns 23/04/2016 00:00:00 o/p of select logical_date -1 from logical_date where logical_date_type='B'…
Rishi Deorukhkar
  • 179
  • 4
  • 15
3
votes
4 answers

ORA-01839 "date not valid for month specified" for to_date in where clause

I have following query (BOCRTNTIME - varchar e.g 2015-02-28 12:21:45, VIEW_BASE_MARIX_T - some view): select BOCRTNTIME from VIEW_BASE_MARIX_T where to_date(substr(BOCRTNTIME,1,10),'YYYY-MM-DD') between (to_date ('2016-01-01',…
Dmitry Kompot
  • 170
  • 1
  • 8
3
votes
1 answer

ORA-01830: date format picture ends before converting entire input string in TOAD

I have a script in which I am writing functions and procedures. The script works absolutely fine in Oracle SQL developer without any errors or warnings. This script I have to provide to a client side customer. The customer user runs the same script…
Namrata
  • 43
  • 1
  • 1
  • 3
3
votes
2 answers

Skip Characters in Oracle TO_DATE function

I'm importing data that has SQL Server formatted dates in a .tsv (yyyy-mm-dd hh24:mi:ss.mmm) into an Oracle database using SQL Developer's Import Data wizard. How can I ignore the .mmm characters for importing them into a DATE column? I cannot seem…
Ehryk
  • 1,930
  • 2
  • 27
  • 47
3
votes
0 answers

Converting a DateTime string in Rails with to_time to_datetime acts different. Why?

After deploying my rails app to a VPS I had some problems with 'time'. After some puzzling I found out that Rails is acting in a strange way when using the date/time conversion. My server is set to timezone "Amsterdam" and in the Rails config I…
MDekker
  • 443
  • 1
  • 4
  • 19
3
votes
1 answer

Error in ToDate function in Pig

I have datetime data in my input and would like to load it correctly from Pig. I googled and learned it's suggested to load as chararray then covert to datetime with ToDate function. However, the same script works for one input but not another,…
user2830451
  • 2,126
  • 5
  • 25
  • 31
3
votes
3 answers

Oracle to_date with p.m./a.m

I need to convert a string into a Date in oracle. The format of the string is like this: '08/11/1999 05:45:00 p.m.' But the last position can change p.m or a.m. I tried to do some like: to_date('08/11/1999 05:45:00 p.m.', 'dd/mm/yyyy hh:mi:ss…
1
2
3
19 20