AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Converting month (number) to month (text)?

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
1itsolution



Joined: 25 Apr 2008
Posts: 3

PostPosted: Fri May 30, 2008 8:01 am    Post subject: Converting month (number) to month (text)? Reply with quote

My script pulls the last modified date from a particular file and returns that as a string. I then want to echo that string to screen in a user friendly format.

So, I have two variables one for the year (_AppYear = 2008) and one for the month (_AppMonth = 04 in this case). I would like the end user to see April instead of 04, or August instead of 08. I imagine I need some sort of table that my script can reference the month string against and return the appropriate month in text.

I'm sure this is very simple but being a relative noob, I'm scratching my head.

Hope someone can point me in the right direction.

Here's my portion of code so far:

Code:

; Checks the datestamp of a file on install disc to confirm that the user is installing the correct monthly update.
FileGetTime, _datestamp, %_FileCheckDataCab%, M
StringLeft, _AppYear, _datestamp, 4
StringMid, _AppMonth, _datestamp, 5, 2
Back to top
View user's profile Send private message
Klaus



Joined: 12 May 2005
Posts: 205
Location: Münster, Germany

PostPosted: Fri May 30, 2008 8:14 am    Post subject: Reply with quote

Hi, 1itsolution,
try something like this
Code:

month05=May
; and so on ...

number=05

msgbox, % month%number%
return

Hope I could help,
Klaus
Back to top
View user's profile Send private message Send e-mail
HugoV



Joined: 27 May 2007
Posts: 650

PostPosted: Fri May 30, 2008 8:30 am    Post subject: Reply with quote

Look into FormatTime
Code:
FileGetTime, _datestamp, %A_ScriptDir%\%A_ScriptName%, M
FormatTime, _Displaydatestamp, %_datestamp%, dd MMM yyyy
MsgBox % _Displaydatestamp
Back to top
View user's profile Send private message
1itsolutution
Guest





PostPosted: Fri May 30, 2008 8:38 am    Post subject: Reply with quote

Thank you both I will try these now.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group