cad29 Posted November 8, 2006 Posted November 8, 2006 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
cad29 Posted November 8, 2006 Author Posted November 8, 2006 correction it is _DateAdd ( 'd', 2, $sDate )
Developers Jos Posted November 8, 2006 Developers Posted November 8, 2006 input date has to be in the format yyyy/mm/dd .. 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.
cad29 Posted November 8, 2006 Author Posted November 8, 2006 thanks jdeb how about if the input data is not yyyy/mm/dd is there anyway to convert it? thanks
Developers Jos Posted November 8, 2006 Developers Posted November 8, 2006 thanks jdeb how about if the input data is not yyyy/mm/dd is there anyway to convert it? thanksSure, 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.
cad29 Posted November 8, 2006 Author Posted November 8, 2006 thanks jdeb i never tried that i dont know how to do can you please show me a script to do it to convert Sep 27,2006 to 2006/9/27 thanks
Developers Jos Posted November 8, 2006 Developers Posted November 8, 2006 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.
cad29 Posted November 8, 2006 Author Posted November 8, 2006 JdeB it works great thank you so much you the man thank you again
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now