To display the date using VBScript, you use the VBScript *date()* function.

date()
VBScript Date Code

To display this to the user, you need to output it like you would anything
else - for example, using the *document.write()* method.

document.write(date())

Or even better, you could put the date into a variable first, then output
the variable:

localDate = date()

document.write(localDate)

VBScript Date Format

You can use the VBScript *FormatDateTime()* method to format the date to
either a *long* date format or a *short* date format.

The FormatDateTime() method accepts two arguments: The date being
formatted, and the required format (indicated by a constant). The formats
are specified as follows:

   - 0 - This represents the default date format (as in the previous
   example)
   - 1 - This represents the long date format (based on the user's regional
   settings)
   - 2 - This represents the short date format (based on the user's
   regional settings)

Long Format

To use long date format, you pass the *FormatDateTime()* an argument of *1*.

localDate = FormatDateTime(date(), *1*)

document.write(localDate)
Short Format

To use long date format, you pass the *FormatDateTime()* an argument of *2*.

localDate = FormatDateTime(date(), *2*)

document.write(localDate)




On Tue, Dec 13, 2011 at 8:16 AM, Chandan Mishra <
[email protected]> wrote:

> Hi All,
>      How to write a calendar programme in Vb Script(Int
> Question).Which will display like system calendar.
>
>
> Regards,
> Chandan Kumar Mishra
>
> --
> You received this message because you are subscribed to the Google
> "QTP - HP Quick Test Professional - Automated Software Testing"
> group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/MercuryQTP?hl=en




-- 
Thanks & Regards
Dinesh Singh
+91-9310813656

-- 
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en

Reply via email to