Micro Focus QTP (UFT) Forums
Datepart().........to check if date is vallid - 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: Datepart().........to check if date is vallid (/Thread-Datepart-to-check-if-date-is-vallid)



Datepart().........to check if date is vallid - swapna_2008 - 02-29-2008

Hi

1)I am entering the date in input pox and the passing the value to datepart function
mydate=inputbox("enter the date")/if i enter date as 29/29/29
datepart("d",mydate)/then it should display 29 as date and when i click ok it should display invalid date.but not workin

2)if i use the same for "date" its is workin
datepart("d'",date)//it displays properly.i mean the system date,as date is a key word

Clarification:Can u jus help me in telling wheater the way i am passing the value in 1 is wrong


RE: Datepart().........to check if date is vallid - sreekanth - 03-05-2008

hi swapna ,
What do you want to display ? is it the system date or the inputed date?


RE: Datepart().........to check if date is vallid - swapna_2008 - 03-05-2008

Hi sreekanth
i jus need to chceck wheather date is valid
for system date tht function works fine............i jus wan any input given....but it should validate wih respect to present date.i mean
1)when we book a ticket if i give ist amrch it should give invalid date

2) this is regarding date fornmat ......it should even chk this like for mm/dd/yy.........if i give 29/02/08...the,it should give an exception


Regards
Swapna


RE: Datepart().........to check if date is vallid - swapna_2008 - 03-05-2008

Oh...ok........sreekant jus let me knoe both the cases , i mean system date and inputed date

swapna


RE: Datepart().........to check if date is vallid - sreekanth - 03-05-2008

Sorry swapna i dont know how to check the format exactly because QTP normally deals with the outer part of the application.And the exception(logic of wether to take the inputted value or not) will be dealt by the back end.

you can verify the lenth,wether Numerical or not etc but not the format of the data.

the outer application designer (ex:HTML designer)can keep a lot of properties for object he can keep the format as a property as well if he wishes.(but this is not a normal practise).

i can't say that this can not be done because, iam not sure of your appication.