Micro Focus QTP (UFT) Forums
Getting System Date in Checkpoint - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Getting System Date in Checkpoint (/Thread-Getting-System-Date-in-Checkpoint)



Getting System Date in Checkpoint - nilu verma - 06-18-2008

I needed to know how I Can put a Checkpoint to Validate my system Date. As scripts are run every day the system date changes so how can i put a checkpoint in there.

Also I would like to know about output checkpoints, how do they work?

Thanks,
Nilu.


RE: Getting System Date in Checkpoint - niranjan - 06-18-2008

you can use Time function to get current system time. And insert a conditional statement. Just a thought...


RE: Getting System Date in Checkpoint - Anshoo Arora - 06-18-2008

When you say system date, do you mean the date in your application?

As for output checkpoints: I think QTP's documentation would be a better source.


RE: Getting System Date in Checkpoint - nilu verma - 06-18-2008

No, I mean the Current Date. That Date I am able to get but how do I put it in a Checkpoint?


RE: Getting System Date in Checkpoint - Ankur - 06-19-2008

I can think of two options, either custom make your checkpoint using if else statement
OR

parameterize your checkpoint to use datatable value and use datatable formula
=NOW()

to get date, right click on datatable cell > Format > date(dynamic)


RE: Getting System Date in Checkpoint - nilu verma - 07-02-2008

Hey Ankur,
I did what you mentioned to get current Date in a Checkpoint but it still fails because it looks at system time & fails by few milliseconds. I s there a way that I can ignore the time factor & just look at the date so that the checkpoint does not fail.
thanks,
Nilu.


RE: Getting System Date in Checkpoint - surya_7mar - 07-07-2008

You can use Date() function wherever you want to call the System Date


RE: Getting System Date in Checkpoint - siri - 07-17-2008

For the above specified one i ma not getting the options of the date and other when i right click on the datatable


RE: Getting System Date in Checkpoint - anemuday - 07-20-2008

Hi,

You can achieve you goal by using the below ways:

1.
Code:
User formatdatetime, if your date is in the format of mm/dd/yyyy.
msgbox(formatdatetime(date()))  'displays date in 7/19/2008
msgbox(formatdatetime(date,2))  'displays date in 7/19/2008
2. Or else you can use some logic to put the date in your required format, here use datepart function:
I used the below code to verify the "Current Time:"(date part) displayed in the top right corner of this page.

Code:
dayPart=datepart("d",date())
monthPart=datepart("m",date())
yearPart=datepart("yyyy",date())

If dayPart<10 Then
    dayPart="0"&dayPart
End If

If monthPart<10 Then
    monthPart="0"&monthPart
End If

reqDate=monthPart&"-"&dayPart&"-"&yearPart
msgbox(reqDate)