Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Getting System Date in Checkpoint
#1
Solved: 11 Years, 4 Months ago Question 
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.
Reply
#2
Solved: 11 Years, 4 Months ago
you can use Time function to get current system time. And insert a conditional statement. Just a thought...
Reply
#3
Solved: 11 Years, 4 Months ago
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.
Reply
#4
Solved: 11 Years, 4 Months ago
No, I mean the Current Date. That Date I am able to get but how do I put it in a Checkpoint?
Reply
#5
Solved: 11 Years, 4 Months ago
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)
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply
#6
Solved: 11 Years, 4 Months ago
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.
Reply
#7
Solved: 11 Years, 4 Months ago
You can use Date() function wherever you want to call the System Date
Reply
#8
Solved: 11 Years, 4 Months ago
For the above specified one i ma not getting the options of the date and other when i right click on the datatable
Reply
#9
Solved: 11 Years, 4 Months ago
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)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Local System Monitor kbhargava505 0 2,522 10-16-2015, 12:52 PM
Last Post: kbhargava505
  QTP system related issue Bharathi Kanagarajan 1 2,090 09-12-2015, 11:28 PM
Last Post: ADITI1992
  System getting locked Anand Saboo 4 3,692 10-24-2013, 05:09 PM
Last Post: Anand Saboo
  Need Help Datatable Parameterzing Date debindas 1 3,680 08-30-2012, 11:43 PM
Last Post: QTPScript
  How To Select Date From a Calender Image Where Date field is non editable? RameshKrishnan 1 4,044 05-28-2012, 09:29 PM
Last Post: defcon3

Forum Jump:


Users browsing this thread: 2 Guest(s)