Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Active Server Pages (ASP)
Expertise: Beginner
Jul 7, 1999

Converting a System Date to a Text String

Question:

I want to retrieve the system date and convert it to a text string. I can get the system date (using the Date() function call), but I cannot write the date to a text file (using the WriteLine method from a TextStream object) unless it is in a string format. The VB Format$() function does not work in the scripting version of VB. Do you have any suggestions?

Answer:

The Format$() function of VB has been replaced by a set of new Format, functions in VBScript.

Use the FormatDateTime function to format a date.

var = FormatDateTime(Date[,NamedFormat])

where NamedFormat = 
0 - General Date
1 - Long Date
2 - Short Date
3 - Long Time
4 - Short Time
DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date