cancel
Showing results for 
Search instead for 
Did you mean: 

Convert Date to Month number : using todate

former_member539471
Participant
0 Kudos

Hello All,

I need to convert a date " mm-dd-yyyy' to month number like '43203'

I am trying to use daysinbetween(firstdate, lastdate)

defining firstdate = ToDate("01/01/1900";"mm/dd/yyyy") and lastdate will be picked from my table

when i create a Dimension in IDT i am getting missing expression for todate . I do not see what wrong i did

Also , ToDate("01/01/1900";"mm/dd/yyyy") asks me to refer a table and i refered some table since.

I need help on where i am going wrong. Please see screenshot.

Thanks everyone.

denis_konovalov
Active Contributor
0 Kudos

I have fixed your tag. Pleas select more careful next time.

Accepted Solutions (0)

Answers (2)

Answers (2)

DellSC
Active Contributor
0 Kudos

The default format that Oracle uses for Dates is 'dd-mon-yyyy' and you can use date strings in that format without a format string. Also, you have an "=" in front of your select statement which may be causing problems. Try this instead:

To_Date('01-JAN-1900')

This may still throw an error on validation because it is not linked to a table. joe.peters2 comment about "instead of" might apply to that, but I usually just ignore that when I know the SQL is correct - it will work when it's added to other fields in a query.

-Dell

Joe_Peters
Active Contributor
0 Kudos

Use ' instead of "