Ask a Question

How to Enter Current System Date for a specific TextField

veera_bolli
Occasional Contributor

How to Enter Current System Date for a specific TextField

Hi,



I try to enter current date in a Date  field .But its failed.

I want to update the text field with current System Date(Format is like 2010/07/21) .Even i changed my system date settings to this format.

But i did't get the result.Here is the code.

                                         Sub Test4

                                         Dim wndCLASS_CHILD

                                         Dim magic_gdt

                                         Set wndCLASS_CHILD = Aliases.uniRTE.wndCLASS_CHILD96

                                         wndCLASS_CHILD.CLASS_CHILD.CLASS_CHILD.btnAllocate.ClickButton

                                         Set magic_gdt = wndCLASS_CHILD.MAGIC_GDT1

    

''' '''''''''''''''''''                  magic_gdt.wText = "2010/07/20"---------->Start Date Field in yyyy-mm-dd format

                                      
Sys.keys "20100720"

                                     Call magic_gdt.Keys("[Tab]")

                                      Set magic_gdt = wndCLASS_CHILD.MAGIC_GDT2

'' ''''''''''''''''''''''''                magic_gdt.wText = "2010/07/20" -------->Second date field

                                      
Sys.keys "20100720"

                                     Call magic_gdt.Keys("[Tab]")

                     End Sub

Here i want to change the date to current Sys.Date.I done using If......Then......Stmt But it doe't disply the current Date.

I want to assign the current date to those date fields.

If any one knows ....Plz Post Reply...



Thanks & Regards

Veera Bolli.
1 REPLY 1
YMinaev
Staff

Hi,



Here's what you need to do:

1. Obtain the current date (aqDateTime.Today).

2. Format it in the way you like (aqConvert.DateTimeToFormatStr)

3. Assign it to the target field's wText property.



See the Working With Dates help topic for more information.
------
Yuri
TestComplete Customer Care Engineer

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
cancel
Showing results for 
Search instead for 
Did you mean: