kiffab Posted July 28, 2011 Posted July 28, 2011 HiI'm connecting to a database, running a query and pulling a date back.Example:SELECT max(createddate) FROM table1In my AutoIt output I will see something like:201107282103I tried using the date convert in the SQL query, which works in Management Studio but not via AutoIt.Is there any way to convert this via AutoIt?Thanks
sleepydvdr Posted July 28, 2011 Posted July 28, 2011 What format do you want to convert it to? This website lists a lot of possibilities: http://www.sql-server-helper.com/tips/date-formats.aspx #include <ByteMe.au3>
kiffab Posted July 28, 2011 Author Posted July 28, 2011 What format do you want to convert it to? This website lists a lot of possibilities:http://www.sql-server-helper.com/tips/date-formats.aspxI don't believe it.... I was on this exact page earlier trying the conversions and thought they werent working in AutoIt. I must've been doing something wrong as it worked in Management Studio. DOH!Tried again and bingo, it's working.Thanks
sleepydvdr Posted July 28, 2011 Posted July 28, 2011 I don't believe it.... I was on this exact page earlier trying the conversions and thought they werent working in AutoIt. I must've been doing something wrong as it worked in Management Studio. DOH!Tried again and bingo, it's working.Thanks You weren't holding your tongue right. #include <ByteMe.au3>
Juvigy Posted August 1, 2011 Posted August 1, 2011 Local $String = "20110722141500" Local $DateTime = StringRegExpReplace($String, "(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})", "\1/\2/\3 \4:\5:\6") ConsoleWrite($String & " to " & $DateTime & @LF) $DateCalc = _DateDiff( 'n',$DateTime,_NowCalc()) ConsoleWrite($DateCalc & @CRLF) If converting from SQL is not an option (like excel/outlook for example).
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