Forum Discussion
tristaanogre
10 years agoEsteemed 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.
Kostja
10 years agoContributor
Hi,
don't want to spam here, but just for the protocol (and the code was only as an example) :) -->
- tristaanogre10 years agoEsteemed Contributor
Fair enough.. :) It must do an automatic data type conversion when referenced like that... one of the "benefits" of a scripting language vs. a strong typed language. :)
- DenisMedvedev10 years agoContributor
maybe it will help you
/* * Function GetFullCurrentDate returns data in string format (03/29/2016) */ this.GetFullCurrentDate = function(){ var date = aqConvert.DateTimeToFormatStr(aqDateTime.Today(), "%m/%d/%Y"); return date; }or
/* * Function GetCurrentDateAndTime returnsCurrent Date and Time in string format (Monday, 28, March, 2016 - 18:36) */ this.GetCurrentDateAndTime = function(){ var date = aqConvert.DateTimeToFormatStr(aqDateTime.Today(), "%A, %d, %B, %Y - "); var time = aqConvert.DateTimeToFormatStr(aqDateTime.Time(), "%H:%M"); return date + time; }