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

How do I get a rolling view of counts?

Goal is to count anyone who fits a criteria on three months back from specified date. The (BetweenDate -3 months) is the tricky part. I am operating within a yearly window not 3 months back from getDate() I need it to be three months back from…
Tinkinc
  • 449
  • 2
  • 8
  • 21
0
votes
2 answers

Age Calculations

I am trying to calculate ages for people with the respect to monthly data so their birth date will reflect a round number in the given month. However I have several rows that provide me with negative ages. Is there any way in this formula to make…
Tinkinc
  • 449
  • 2
  • 8
  • 21
0
votes
3 answers

How to find a specific mask within a string - Oracle?

I have a field in a table that can be informed with differente values. Examples: Row 1 - (2012,2013) Row 2 - 8871 Row 3 - 01/04/2012 Row 4 - 'NULL' I have to identify the rows that have a string with a date mask 'dd/mm/yyyy' informed. Like Row…
user2171763
  • 57
  • 2
  • 6
0
votes
2 answers

Strings with TO_DATE command as value on the database

I have a problem and I can't solve it yet. On my database I have the string: TO_DATE(' 2015-03-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'). So when I'm building my query it is like the following: Select my_field FROM…
oeddy
  • 35
  • 4
0
votes
2 answers

Strange behaviour when filtering by date in Oracle

I'm on an Oracle database, the following query: select codi_belf, data_elab,id_inte,anno from mimsspam_tab where id_inte = 504; retrieves 6 records E924 05-AGO-15 504 2015 D458 05-AGO-15 504 2015 D458 05-AGO-15 504 2015 B275 …
0
votes
2 answers

Oracle to_date SQL formatting odd behavior

I've trawled the SO website thinking this is pretty obvious but alas I have not found one yet. Basically the setup is as follows: I have a string in a table like so: 06/22/2010 00:00:00 I do a select on it: SELECT To_Date(item, 'MM/DD/YYYY…
Rio
  • 14,182
  • 21
  • 67
  • 107
0
votes
1 answer

ToDate function provides unexpected output

I used the ToDate(userinput, format) function to covert my chararray field. I used the ToDate(userinput, 'MM/dd/yyyy') to covert the field from chararray to date but looks like i am not seeing the output as i had expected. Here is the code: l_dat =…
Bimal
  • 17
  • 5
0
votes
1 answer

Pig ToDate casting error

I have a date field that I am trying to cast as 'ToDate' via The dates look like this 2015-03-28@18:21:18. ToDate(REPLACE(REPLACE(Date_Time, '@', ' '),'.',''),'yyyy-MM-dd HH:mm:ss') The job dies and gives me this error; Backend error : Invalid…
chattrat423
  • 603
  • 2
  • 11
  • 24
0
votes
1 answer

Usage of ToDate Function

I wanted to convert userinput:chararray to date, so I am planning to use the ToDate(userinput,'dd/MM/yyyy') function. I have searched the forum to see if people have used it but I am not sure if I need to register anything like piggybank.jar to use…
Bimal
  • 17
  • 5
0
votes
1 answer

TO_DATE function couldn't execute in Sql query

TO_DATE function couldn't prepare statement. Where is mistake in this query? UPDATE Employees SET BirthDate = TO_DATE('01042015233514','DD.Month.YYYY HH:MI:SS'), LastName = 'YURTCU' WHERE FirstName = 'SENEM'; Please help me. Thank You!
Senem Yurtcu
  • 70
  • 2
  • 16
0
votes
3 answers

SQL Grabbing hotel room availability between two dates

As the title states, I'm trying to grab all available hotel rooms when a user specifies a check in and check out date. I've made some progress, but I'm struggling to understand the logic behind this process. Here's what I have: SELECT r.FLOOR,…
Jon Perron
  • 83
  • 9
0
votes
0 answers

Oracle hour format (syntax)

Maybe this question could have been awnsered in nother post, but I can not find anything similair to my problem (or I can not see the solution). My question is as follow: I work in an Oracle11g database and I would like to pass my to_date value to…
Maxime de Lange
  • 287
  • 2
  • 7
  • 21
0
votes
1 answer

to_date and to_char issue

I need to delete records inserted in the last minute and i have to use a specific system date that exists in my database and that is actually truncated (select sys_date from dual returns 20/3/2014). i tried to format the date to show minutes and…
mardeea
  • 45
  • 1
  • 7
0
votes
1 answer

Oracle SQL to_date & to_timestamp ORA-01858: a non-numeric character was found where a numeric was expected & ORA-01850: hour must be between 0 and 23

I have a small bit of code: Code SELECT to_date(it.DSTAMP, 'DD/MM/YYYY') AS "Date", to_timestamp(it.DSTAMP, 'HH24:MI:SS') AS Time FROM itable it Errors ORA-01858: a non-numeric character was found where a numeric was expected 01858. 00000 - "a…
Matt
  • 14,906
  • 27
  • 99
  • 149
0
votes
2 answers

Comparing varchar date with sysdate

I am trying to query sum_date WHERE sum_date BETWEEN (sysdate-1) AND (sysdate-30) In my SELECT statement I have tried TO_DATE(sum_date, 'DD-MM-YY') and sysdate But it throws error: "literal does not match format string." Sum_date is stored as…
tx_query
  • 21
  • 2
  • 4