Month Names

ravisemilo

Member
Licensed User
Longtime User
First of all, this is my first post while trying to make my first application. I'm not a programmer by training and using this great tool B4A more as a hobby. Please excuse me if my questions are basic or silly.

I'm trying to enter rows into a database table, one of the columns of which is month of the year. I have to insert 12 rows starting from April to March of next year. I was looking for some function like MonthName(i) so that I can loop from 1 to 12, instead of typing out all the months.

I don't think the GetMonth will work for me as I don't have the ticks.

Thanks
Ravi
 

MLDev

Active Member
Licensed User
Longtime User
You can do something like this:

B4X:
Dim MonthName() As String
MonthName = Array As String("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December")

month = MonthName(0) ' month = "January"
 
Upvote 0

ravisemilo

Member
Licensed User
Longtime User
Thanks MLDev, I seem to have stuck up with date and calendar functions and missed the array. Works perfect.

Ravi
 
Upvote 0
Top