Ask a Question

aqDatetime.Today()

yoorahn
Contributor

aqDatetime.Today()

Hellow, I wonder about code expression. 

I want to receive the today Date text using ' . '(dot) form like '2021. 8. 30.' 

 

So I tried Set variable Value and receive the today date using aqDateTime.Today() code expression. 

but that method use ' - ' form. (2021-08-30)

 

how can i change ' - ' to ' . '  ? 

 

 

8 REPLIES 8
Marsha_R
Community Hero

Re: aqDatetime.Today()

This will work for you

https://support.smartbear.com/testcomplete/docs/reference/program-objects/aqstring/replace.html


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
yoorahn
Contributor

Re: aqDatetime.Today()

Thank you. .....

But I don't know how I use  'aqDateTime.Today' with 'aqString.Replace'.

1. I wanna input text 'today's date(year, month, day) 

2. so I used aqDateTime.Today() code expression

3. So i got '2021-08-31' text

4. But What I need form is '2021. 8. 31' form. 

5. So I must use the 'aqString.Replace()'

6. But I don't know how I arrage or use this code expression... 

Please give me solutions............ 

 

yoorahn_1-1630375144335.png

 

Marsha_R
Community Hero

Re: aqDatetime.Today()

You got close! Put aqReplace on the outside and use aqDateTime.Today() as the string input.

Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
yoorahn
Contributor

Re: aqDatetime.Today()

yoorahn_0-1630469630505.png

Thank you! I finally did it change '-' to '.' 
So i got '2021.09.01' form.

But Finally What I wanna do is.. '2021. 9. 1.' form..

So at last result, I need to change '0' to 'blank'. 

is this possible ..? 

 

 

Marsha_R
Community Hero

Re: aqDatetime.Today()

Try it and see!  That's the best way.  If it doesn't turn out the way that you want it, then show us what you did and tell us how the result was different from what you wanted.


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
yoorahn
Contributor

Re: aqDatetime.Today()

I need     2021. 9. 9.   today form. 

So I tried many times. 

First, I replaced "-" to "." 

Second, I removed "0". 

So Finally got   221. 9. 9.    Form. 

But I need 2021. 9. 9.   form... 

How can I solve this...?

yoorahn_1-1631164041235.png

 

yoorahn_0-1631164022799.png

 

Marsha_R
Community Hero

Re: aqDatetime.Today()

Search for .0
and replace it with . and a space

That will keep it from seeing the 0 in the year

Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
AlexKaras
Community Hero

Re: aqDatetime.Today()

Hi,

 

Consider the aqConvert.DateTimeToFormatStr() method (https://support.smartbear.com/testcomplete/docs/reference/program-objects/aqconvert/datetimetoformat...).

 

(I think that something like aqConvert.DateTimeToFormatStr(aqDateTime.Today(), "%Y.%#m.%#d") should work for you.)

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
cancel
Showing results for 
Search instead for 
Did you mean: