Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

convert month name

Status
Not open for further replies.

hawley

Programmer
Dec 16, 2002
37
US
If you have a string that is equal to "June" how do you convert that to the month number, 06.

I have found stuff on getmonth and such but I don't have the whole date. Just the month name.

Thanks!!!
 
Easy way would be just to use a case statment:


string ls_month
integer i_month_num

Choose Case ls_month
CASE 'June'
i_month_num = 06
Case 'July'
i_month_num = 07
End CHOOSE
 
Or...

string ls_month
integer li_month

ls_month = 'June'

select datepart(mm,'01 '+ls_month+' 2000')
into :li_month
using sqlca;

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top