NisHera's avatar
NisHera
Valued Contributor
5 years ago
Status:
New Idea

Implement Get Date function

In aqDatetime Object,  GetDate() fucntion is missing.

for eg no direct way to compare x = 2019-08-19 with y = 2019-08-19:11:55:25.00.00

x <>y 

hence y need to rip out time fraction to be  x=y

aqDateTime.Compare(xy) =0

 

3 Comments

  • NisHera's avatar
    NisHera
    Valued Contributor

    Seems you did not understood the problem...

    there is nothing to do with Today()...............

     

    eg:- from external application I receve date time say x= '11/12/2014 9:58:11'

    in test complete script  I have date say y ='11/12/2014'  

     

    I need to compare x and y  say both are same (if you ignore time component.........)

    if i used 

    aqDateTime.Compare(x,y) 

    result will be 1 or -1 not 0 .. b'cos of time component of x

     

    only way to get result both are same ....have to rip off time...

    like below ..can remove seconds...

    y = aqDateTime.AddSeconds(y,  - aqDateTime.GetSeconds(y))

    hours ...

    minutes...

     

    why can't TC provide me a single function?

     

     

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Are these strings?  Or are they objects of type DateTime?

     

    If they are strings, then this is string manipulation, not DateTime processing.  I wouldn't even use aqDateTime.Compare.  Heck,, you just want to see if x contains y, right?

    if aqString.Contains(x,y) <> 0 then "Dates do not match" else "Dates  match"


    It's simply a matter of finding the right function.