Jump to content

Search the Community

Showing results for tags 'Date functions'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. Hi all , This is a little function to get a valid date value from given 3 integer values. For example, if we give 2008, 10, 25 as parameters, it will give a valid date from it. Here is the code #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.12.0 Author: kcvinu Build Date : 09-03-2015 Script Function: It will give a valid date as output if you give year month and date. Example DigitsToDate(2011,8,26,1) will give 26/08/2011 Last parameter is flag ; $flag 1 = dd-mm-yyyy ; $flag 2 = mm-dd-yyyy ; $flag 3 = yyyy-dd-mm ; $flag 4 = yyyy-mm-dd Return Value If all parameters are correct then it will give you a date value as per flag This function will return -1 when you give month greater than 12 or month lesser than 1 This function will return -1 when you give day greater than 31 or month lesser than 1 This function will return -1 when you give year greater than 9999 or lesser than 1 This function will return -2 when you give a leap year as year and month as february and day greater than 29 This function will return -3 when you give day greater than 30 and months which not have more than 30 days Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here Func DigitsToDate($Year, $Month, $Day, $flag) Local $31Club[4] = [4, 6, 9, 11] For $i In $31Club If $i = $Month And $Day > 30 Then Return -3 Next Local $LeapFlag If StringRight($Year, 2) = 00 Then If IsFloat($Year / 400) Then $LeapFlag = 0 Else $LeapFlag = 1 EndIf ElseIf StringRight($Year, 2) <> 00 Then If IsFloat(StringRight($Year, 2) / 4) Then $LeapFlag = 0 Else $LeapFlag = 1 EndIf EndIf If $LeapFlag = 1 And $Month = 2 And $Day > 29 Then Return -2 If StringLen($Year) <> 4 Then Return -1 If StringLen($Month) > 2 Then Return -1 If StringLen($Day) > 2 Then Return -1 If $Year < 1 Then Return -1 If $Month < 1 Or $Month > 12 Then Return -1 If $Day < 1 Or $Day > 31 Then Return -1 If $Month < 10 And StringLen($Month) = 1 Then $Month = 0 & $Month If $Day < 10 And StringLen($Day) = 1 Then $Day = 0 & $Day If $flag = 1 Then Return $Day & "/" & $Month & "/" & $Year If $flag = 2 Then Return $Month & "/" & $Day & "/" & $Year If $flag = 3 Then Return $Year & "/" & $Day & "/" & $Month If $flag = 4 Then Return $Year & "/" & $Month & "/" & $Day EndFunc ;==>DigitsToDate And here is the *.au3 file DigitsToDate.au3
×
×
  • Create New...