kiffab 0 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 Share this post Link to post Share on other sites
smartee 14 Posted July 28, 2011 Use StringRegExp(), its fun Share this post Link to post Share on other sites
sleepydvdr 8 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> Share this post Link to post Share on other sites
kiffab 0 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 Share this post Link to post Share on other sites
sleepydvdr 8 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> Share this post Link to post Share on other sites
Juvigy 49 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). Share this post Link to post Share on other sites