WORKING WITH QTP

TestEveryThinG

Using Date in VB script

Posted by rajivkumarnandvani on January 1, 2010

Hi All,
Some time we required date in different format like DD/MM/YY but when we use now or date function it will written the value as per ur system configuration date format like if today is 1st jan 2010 and we need the date in DD/MM/YY format means 01/01/2010 but it will written 1/1/2010 if date 31 jan 2010 then it will written 31/1/2010 while we need 31/01/10
so for this we can use in this way

dim dayvalue, monthvalue , yearvalue
dayvalue =right(“0″&day(now),2)
msgbox “dayvalue =” &dayvalue

monthvalue =right(“0″&month(now),2)
msgbox “monthvalue =” & monthvalue
yearvalue=right(year(now),2)
msgbox “yearvalue =” & yearvalue

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: