Forum Discussion
9 Replies
- DenisMedvedevContributor
Hi, convert it to string and try bellow code
string.replace(searchvalue,newvalue)
works for JS
- KostjaContributor
Hi,
how about this? --> https://support.smartbear.com/viewarticle/73731/
E.g.:
var x = aqDateTime["Now"]();
var x = aqString["Replace"](x,'2016','2013');Greetings
- tristaanogreEsteemed Contributor
The replace method is correct... however, I don't think you can do it directly with aqDateTime(Now) as that doesn't return a string but a DateTime value which is a numeric value. What you would have to do is take what aqDateTime returns and run it through aqConvert.DateTimeToStr or aqConvert.DateTimeToFormatStr in order to put the date into a string format. Then you can do the necessary string replace call.
- KostjaContributor
Hi,
don't want to spam here, but just for the protocol (and the code was only as an example) :) -->
- baxatobCommunity Hero
initial_date = '9/2/2016' new_date = aqDateTime.AddMonths(initial_date, -36) # ==> 9/2/2013
It uses system format by default. If you need another date format, use aqConvert.DateTimeToFormatStr method.
- JanisOccasional Contributor
Please suggest what shoud I do to get the date as Feb 5, 2016?
- baxatobCommunity Hero
date = 2/5/2016 new_date = aqConvert.DateTimeToFormatStr(date, "%b %#d, %Y") # ==> Feb 5, 2016
All date/time specifiers are here: https://support.smartbear.com/viewarticle/73413/
Related Content
- 5 years agoReshail
- 8 years agoilovechiku
- 10 months agoesoysal
Recent Discussions
- 6 hours agoSvetaG