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 

Valid timestamp?

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Bug Reports
View previous topic :: View next topic  
Author Message
nick



Joined: 24 Aug 2005
Posts: 345
Location: Berlin / Germany

PostPosted: Sat Aug 16, 2008 10:38 am    Post subject: Valid timestamp? Reply with quote

Code:
#NoEnv
AHK_Version := "1.0.47.06"

Date := 20081515

If Date Is Not Time
   MsgBox, Invalid Timestamp : %Date%
   
FormatTime, FDate, %Date%, dd.MM.yyy
MsgBox, %FDate%

ExitApp

Quote:
---------------------------
TimeStamp.ahk
---------------------------
15.01.2008
---------------------------
OK
---------------------------

Bug or feature?
_________________
nick

denick @ http://de.autohotkey.com/forum/
Back to top
View user's profile Send private message
Peter



Joined: 30 Dec 2005
Posts: 279

PostPosted: Sat Aug 16, 2008 12:10 pm    Post subject: Reply with quote

I don't see much of a feature in it. I've tested a bit more.
And it seems that Ahk doesn't care about the month number, any number will be valid according to Ahk. On the other hand it checks correct on days, also for special months like February. (And also correct on hours, minutes, sec.)
Code:
#NoEnv
AHK_Version := "1.0.47.06"

Invalid := 0
Loop, 100 {
   Month := "0" . (A_index - 1)
   StringRight, Month, Month, 2
   Day := "10"
   ; Day := "0" . A_index     ; same test w/ days gives correct result
   ; StringRight, Day, Day, 2
   ; Month := "10"
   Date = 2008%Month%%Day%
   tooltip %Date%
   If Date Is Not Time
   {
      Invalid++
      InvalidList := InvalidList . A_index . ","
   }
}
MsgBox, %Invalid% invalid dates `nInvalidList= `n%InvalidList%
ExitApp
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Bug Reports 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