kaangyib Report post Posted 07/08/2013 06:45 AM Hi Support team, If I want to evaluate a date which is TRUE if the current date is between 2 given dates. How can I achieve this? E.g: current date = 07/08/2013 ... Date1 = 01/31/2013 ... Date2 = 09/15/2013 Please guide me. Thanks! Share this post Link to post
SupportTeam Report post Posted 07/16/2013 11:10 AM One approach would be to use two DateDiff functions and ensure that tested date is above starting date but below ending date. Below shows basic approach: Date1="5/15/2013 12:00:00 AM" Date2="10/20/2013 12:00:00 AM" testDate="07/26/2013" iResult1 = DateDiff("d", Date1, testDate) iResult2 = DateDiff("d", Date2, testDate) if iResult1 > 0 and iResult2 < 0 then MsgBox "testDate is in date range" end if Share this post Link to post
kaangyib Report post Posted 09/01/2013 06:58 PM Hi, What if I want to change the date value retrieve from database to mm/dd/yyyy, how can I achieve this? For example, if the date value retrieved from database is 5/1/2013, and I want to change it to 05/01/2013, how can I do this? It goes the same if the date value retrieved from database is 5/11/2013, I want to change it to 05/11/2013, how can I do this? Please advise. Thanks! Share this post Link to post
SupportTeam Report post Posted 09/01/2013 08:56 PM One approach would be to split it into day and month parts and then look each one individually to see if it is one character long or two. if it is one character the prepend a "0" to it and then concatenate them together again. Of you could see if it is possible to change the database or the data provider to return data is desired format. Or you could try using a VBScript FormatDateTime function with vbShortDate setting. Share this post Link to post