system
November 12, 2009, 9:52am
1
Hi,
I have a problem with using todate function.
I have a string which contain year and month.
I need to convert this to Date so that I can get the Month.
For e.g. String contains “2009-10” and I need it as October
Can some one help me in this?
Regards
Niranjan
nvkanade (BOB member since 2009-06-25)
system
November 12, 2009, 9:56am
2
Hm… Append 01 to your string “2009-10” convert it to Date and then use Month() function. Something like this will help you out.
=Month(ToDate([String date]+"-"+"01","yyyy-MM-dd"))
Jansi (BOB member since 2008-05-12)
system
November 12, 2009, 10:02am
3
Hello,
you can try something like this:
select substr('2009-10',0,5)||to_char(to_Date(substr('2009-10',6,2),'MM'),'Month') from dual
If it doesn’t work let me now please
Regards
edit: sorry, I did not see a preevious response
[Moderator Edit: Added code formatting - Jansi]
radiohead (BOB member since 2007-04-13)
system
November 12, 2009, 11:27am
4
Hello,
you can try something like this:
select substr(‘2009-10’,0,5)||to_char(to_Date(substr(‘2009-10’,6,2),‘MM’),‘Month’) from dual
Do we have TO_CHAR() function in WEBI?
Rakesh_K (BOB member since 2007-12-11)
system
November 12, 2009, 11:30am
5
No to_Date(), dual too. It should be a universe level suggestion.
@radiohead : Please post the db details too when you’re providing universe level solutions. Thanks.
Jansi (BOB member since 2008-05-12)
system
November 12, 2009, 11:49am
6
Hello,
sorry you’re right, this was a basis for a solution at universe level, and that would apply to a Oracle Database.
Best Regards
radiohead (BOB member since 2007-04-13)