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

Convert Concatenated String to Column Name in Oracle SQL

Problem Statement: I have a table named ACTIVITIES with all columns having a datatype of varchar(20) shown below: |ACTIVITY_NAME| Q1 | Q2 | Q3 | Q4 | |ACT1 |02/05 |05/10 |08/21 |11/15 | |ACT2 |01/20 |06/11 |08/06 |10/21…
k.gelo
  • 3
  • 4
0
votes
4 answers

Converting dates stored as VARCHAR2 to a date

I have seen similar posts to this, but I am not able to resolve my query. I am trying to query a table that has a column ("VALUE") of VARCHAR2 datatype. The rows in this column are mixed with both numerical and date values (I do not know why the…
jrh11570
  • 1
  • 3
0
votes
0 answers

How to create a unique index in postgresql with to_date

We are moving from Oracle to Postgresql. In Oracle we have the following unique index: CREATE UNIQUE INDEX USER_UI1 ON USER (LOGINID, COALESCE(DATEDELETED,TO_DATE(' 1900-01-01 00:00:00', ' YYYY-MM-DD HH24:MI:SS'))); When I try to create a similar…
irrational
  • 767
  • 7
  • 24
0
votes
2 answers

How to convert chararray to datetime with milliseconds in pig latin

I wish to convert following value which is a chararray in pig 2016-05-11 23:59:57.628197 to 2016-05-11T23:59:57.628-05:00 How can I do it ? Following is what I tried considering alias 'a2' contains list of datetime values in chararray in the…
nitinr708
  • 1,393
  • 2
  • 19
  • 29
0
votes
0 answers

Why is to_date(date, 'dd-mm-yyyy') still an error?

I am running this procedure to calculate total price based on days inserted. CREATE OR REPLACE PROCEDURE calcTotal (p_checkInDate IN STAYRECORD.checkInDate%TYPE, p_checkOutDate IN STAYRECORD.checkOutDate%TYPE, p_cageNo IN…
0
votes
1 answer

Casting partial dates in Postgresql

I have a dataset that contains a birthdate attribute. The date format is M/D/YYYY(single digit representation such as 5/8/2009) and stored in text format. Now, I need to change the column type to date. But, there are many entities (more than that…
Ahmadov
  • 1,567
  • 5
  • 31
  • 48
0
votes
1 answer

Cx_oracle: To_date with variables in python

I am trying to do this startdate = "20160123" enddate = "20160204" cmd = "select identification_number from bug where submitted_date >= TO_DATE(:1,'dd-MON-yy') and submitted_date <= TO_DATE(:2,'dd-MON-yy')" cursor.execute(cmd,(startdate,enddate)) I…
user2471313
  • 63
  • 1
  • 3
  • 10
0
votes
4 answers

oracle sql - a non-numeric character was found where a numeric was expected

I know there are loads of postings regarding fixing this error but, I'm just not understanding it! val_strg1 value is 01.04.2016. I want to use this and not show lines where this date is older than current date, (i.e. and trunc(sysdate) <…
SMORF
  • 499
  • 6
  • 13
  • 30
0
votes
2 answers

How to convert string to date format?

Hi any one please help me... The below mentioned line is one column data. column1:Supplier Setup request submitted on 2016-01-06 06:00:25.141 by WFS ADMINISTRATOR I want to divide into two columns like columnA and columnB: columnA …
bharathi
  • 3
  • 1
  • 6
0
votes
1 answer

Need format mask

I am getting format string not recognized. Date we are getting from source : 2015-11-15 02:22:11.000 GMT Can anyone help me with proper mask for this to convert in TO_DATE(date,'YYYY-MM-DD HH24:MI:SS TZR') Need output in 15/11/2014 2:22:00 AM
Karthik
  • 1
  • 1
0
votes
2 answers

Oracle - Get date from date time using to_date()

I getting an XML date/time from an XML file and need to load it in a datatype of just Date, so I have to truncate the time. I would like to try something like this in order to let Oracle do the truncation: TO_DATE('2015-11-04…
NealWalters
  • 17,197
  • 42
  • 141
  • 251
0
votes
1 answer

Strange TO_DATE and SQLPLUS behavior

I have a query that supplies the SYSDATE and a hardcoded time value coming from a configuration file. select request_rrn||','||transfer_id||','|| client_id||','||src_fund_acct_id||','|| tgt_fund_acct_id||','|| to_char((timestamp + 8/24),…
makalshrek
  • 853
  • 3
  • 14
  • 29
0
votes
4 answers

Why wont TO_DATE return the TIME section of my query?

I am trying to convert EPOCH to a HUMAN DATETIME. When I test this on their website, it returns the right value. When I do it within SQL Developer, it's wrong. This lead me to check other basic SQL to see how they get returned, select sysdate…
Runawaygeek
  • 115
  • 3
  • 13
0
votes
3 answers

Calculate age in Oracle/Toad - using values from two columns

I have two Oracle columns (in a VIEW, not a table) - DateOfBirth and MembershipDate. I am trying to create a new column that will show the age of the person on the date that they took up the membership. Sample columns:DateOfBirth:…
Mr.L
  • 1
  • 2
0
votes
2 answers

How to extract only time from '0/0/0000 10:23:56 AM'?

I am having date as 0/0/0000 10:23:56 AM in a column. I have tried with TO_CHAR(column_dt,'hh24:mm:ss') and TO_CHAR(column_dt,'hh:mm:ss pm'), but both are returning 00:00:00 and 00:00:00 00 respectively. Can any one please help me out ?
Soumya
  • 19
  • 4