prabhjot88singh
6 years agoContributor
How to Convert String to Date, Add some Days to it and convert back to String
Hello Users,
I have one query here and stuck in one of the places:
I have DATE column with value as 10-JAN-2020,(i.e. Date-Month-Year) format.I have already stored this value in a variabl...
- 6 years ago
Your going to use a combination of aqConvert, aqDateTime, and aqString methods to do what you want. Here's what I did in JavaScript
function convertString(dateString, daysToAdd){ var varDateTime; varDateTime = aqConvert.StrToDateTime(dateString); varDateTime = aqDateTime.AddDays(varDateTime, daysToAdd); return aqString.ToUpper(aqConvert.DateTimeToFormatStr(varDateTime, '%d-%b-%Y')); } function test(){ Log.Message(convertString('31-JUL-2019', 5)) }
run the Test function and I get 05-AUG-2019 in my log.