2
Function CurrMonthName(dateval)
 Dim tmp : tmp = DateAdd("m", 0, dateval) 
CurrMonthName = MonthName(Month(tmp)) 
CurrMonthName = replace(CurrMonthName , "%M",CurrMonthName)

i am trying to format the month name so that it displays first 3 letters. On searching found %M can be used. I tried using it in above code and results are not coming as expected. It is still displaying full month

ajay k
  • 59
  • 6

2 Answers2

1

In VBScript, the way to get an abreviated Monthname is MonthName.

>> WScript.Echo MonthName(Month(Date()), True)
>>
Jul
>>

See this answer for a more flexible way to format dates (and other kind of data).

Community
  • 1
  • 1
Ekkehard.Horner
  • 38,498
  • 2
  • 45
  • 96
0

Use the function "Left" to cut the first off: Left("February",3) gives you "Feb"

Shnugo
  • 66,100
  • 9
  • 53
  • 114