SubName: Returns the current month as a full string
Description: The following returns the current month as a full string, thus there's no need to worry about putting the months in a string array to loop through it.
The following code returns the month as January, February, March, April, May, June, July...
Tags: date format, return month
Description: The following returns the current month as a full string, thus there's no need to worry about putting the months in a string array to loop through it.
The following code returns the month as January, February, March, April, May, June, July...
B4X:
'First store the original date format.
Dim Ref As Reflector
Ref.Target = Ref.RunStaticMethod("android.text.format.DateFormat", "getDateFormat", Array As Object(Ref.GetContext), Array As String("android.content.Context")) 'Returns default system date pattern
'Then set the date format and store/print the month
DateTime.DateFormat = "MMMM"
Log(DateTime.Date(DateTime.Now)) 'February
'Now restore the original date format.
DateTime.DateFormat = Ref.RunMethod("toPattern")
Log(DateTime.Date(DateTime.Now)) '15/02/2015 in my case
Last edited: