Jump to content

Date Help


cad29
 Share

Recommended Posts

Hi I need help in my date program i have a program that it will automatically add 2 days once he got a data from a web site but the problem is if the data is like this SEP 27,2006 it doesnt add automatically i do the

heres the program

movemouse(287,313,2,1)

send("^c")

$date = ClipPut()

$Newdate = _DateAdd ( $sType, 2, $sDate )

msgbox(0,"New Date",$Newdate)

this one works fine once the value he got from date is like this '2004/1/31' but once he got a value of alpha numeric SEP 27,2006 it doesnt add anymore

Any help please thank you so much

Link to comment
Share on other sites

  • Developers

thanks jdeb how about if the input data is not yyyy/mm/dd is there anyway to convert it? thanks

Sure, i am sure that can be done ...

did you try to StringSplit the input date using SPACE an COMMA as seperators and then translate the month name to a value and put them in the right sequence ?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

Something like this should work:

Global $A_Mon[13] = ["", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
$I_Date = "Sep 27,2006"
$a_Date = StringSplit($I_Date, " ,")
$Mon = 0
For $x = 1 To 12
    If $a_Date[1] = $A_Mon[$x] Then
        $Mon = StringRight("0" & $x, 2)
        ExitLoop
    EndIf
Next
$newdate = $a_Date[3] & "/" & $Mon & "/" & $a_Date[2]

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...