18.01.2013 Views

VBScript Reference Manual for InduSoft Web Studio

VBScript Reference Manual for InduSoft Web Studio

VBScript Reference Manual for InduSoft Web Studio

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>InduSoft</strong> <strong>Web</strong> <strong>Studio</strong> <strong>VBScript</strong> <strong>Reference</strong> <strong>Manual</strong><br />

CCur<br />

Description Returns an expression that has been converted to a Variant of subtype Currency<br />

Usage curVal = CCur(expression)<br />

Arguments expression<br />

The expression argument is any valid expression<br />

Return An expression converted to a Currency value<br />

Remarks CCur provides an internationally aware conversion from any data type to a Currency subtype.<br />

The return value is based on the locale settings on the local PC. For example, different decimal<br />

separators and thousands separators are properly recognized depending on the locale setting of<br />

your system.<br />

See also CBool, CByte, CDbl, CInt, CLng, CSng, CStr<br />

Example Dim myDouble, myCurr<br />

myDouble = 543.214588 'myDouble is a Double.<br />

myCurr = CCur(myDouble * 2) 'Multiply by * 2 and convert<br />

MsgBox myCurr ‘Result 1086.4292 (based on local PC settings)<br />

CDate<br />

Description Returns an expression that has been converted to a Variant of subtype Date.<br />

Usage dateVal = CDate(date)<br />

Arguments The date argument is any valid date expression, of numeric or string type .<br />

Remarks Use the IsDate function to determine if date can be converted to a date or time. CDate<br />

recognizes date literals and time literals as well as some numbers that fall within the range of<br />

acceptable dates. When converting a number to a date, the whole number portion is converted to<br />

a date. Any fractional part of the number is converted to a time of day, starting at midnight.<br />

CDate recognizes date <strong>for</strong>mats according to the locale setting of your system. The correct order<br />

of day, month, and year may not be determined if it is provided in a <strong>for</strong>mat other than one of the<br />

recognized date settings. In addition, a long date <strong>for</strong>mat is not recognized if it also contains the<br />

day-of-the-week string.<br />

If your PC is set to the American date <strong>for</strong>mat (mm/dd/yy), and you enter the British date <strong>for</strong>mat<br />

(dd/mm/yy) in a text box, the CDate function will convert it to the American mm/dd/yy <strong>for</strong>mat.<br />

The following example uses the CDate function to convert a string to a date. In general, hard<br />

coding dates and times as strings (as shown in this example) is not recommended. Use date and<br />

time literals (such as #10/19/1962#, #4:45:23 PM#) instead.<br />

See also IsDate, DateValue, TimeValue<br />

Example myDate = "October 19, 1962" 'Define date.<br />

myShortDate = CDate(myDate) 'Convert to Date data type.<br />

myTime = "4:35:47 PM" 'Define time.<br />

myShortTime = CDate(myTime) 'Convert to Date data type<br />

myShortDate = CDate(#04/18/2006#) ‘myShortDate holds value 4/18/2006<br />

<strong>InduSoft</strong>, Ltd. 119

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!