vbscript – DateAdd

**FUNCTION:** `DateAdd(interval, number, date)`

**Description**
Ajoute un intervalle (jours, mois, années, etc.) à une date.

**Syntax**
`DateAdd(interval, number, date)`

**Paramètres**
– `interval` : Code d’intervalle (ex: « d » jours, « m » mois, « yyyy » années).
– `number` : Nombre d’unités à ajouter (peut être négatif).
– `date` : Date de base.

**Retour**
Nouvelle date.

**Exemples**
« `vb
WScript.Echo DateAdd(« d », 7, Date)
WScript.Echo DateAdd(« m », 1, CDate(« 2026-02-09 »))
« `

**Output :** `date+7j ; date+1mois`

**Voir aussi**
`DateDiff`, `DatePart`, `DateSerial`

vbscript – Now

**FUNCTION:** `Now()`

**Description**
Retourne la date et l’heure courantes.

**Syntax**
`Now()`

**Paramètres**
– *(aucun)*

**Retour**
Une valeur Date (date+heure).

**Exemples**
« `vb
WScript.Echo Now
« `

**Output :** `date+heure courante`

**Voir aussi**
`Date`, `Time`, `Timer`

vbscript – IsDate

**FUNCTION:** `IsDate(expression)`

**Description**
Indique si une expression peut être convertie en date/heure.

**Syntax**
`IsDate(expression)`

**Paramètres**
– `expression` : Chaîne/valeur à tester.

**Retour**
`True` si convertible en date, sinon `False`.

**Exemples**
« `vb
WScript.Echo IsDate(« 2026-02-09 »)
WScript.Echo IsDate(« not a date »)
« `

**Output :** `True/False selon parsing locale`

**Voir aussi**
`CDate`, `DateValue`, `TimeValue`

vbscript – CStr

**FUNCTION:** `CStr(expression)`

**Description**
Convertit une expression en chaîne (String).

**Syntax**
`CStr(expression)`

**Paramètres**
– `expression` : Valeur à convertir (nombre, date, booléen, etc.).

**Retour**
Une chaîne.

**Notes**
– Pour formater un nombre, préférer `FormatNumber()`/`FormatCurrency()` plutôt que `CStr()`.

**Exemples**
« `vb
WScript.Echo CStr(123)
WScript.Echo CStr(Now)
« `

**Output :** ` »123″, date/heure selon locale`

**Voir aussi**
`FormatNumber`, `FormatCurrency`, `FormatDateTime`

vbscript – CInt

**FUNCTION:** `CInt(expression)`

**Description**
Convertit une expression en entier (type Integer). Arrondit à l’entier le plus proche.

**Syntax**
`CInt(expression)`

**Paramètres**
– `expression` : Valeur numérique ou chaîne convertible en nombre.

**Retour**
Un entier (Integer).

**Notes**
– Pour une conversion plus “large” (32-bit), utiliser `CLng()`.
– Pour tronquer au lieu d’arrondir, utiliser `Fix()` ou `Int()` selon le besoin.

**Exemples**
« `vb
WScript.Echo CInt(2.4)
WScript.Echo CInt(2.5)
WScript.Echo CInt(-2.5)
« `

**Output :** `2, 2 (ou 3 selon règles d’arrondi), -2`

**Voir aussi**
`CLng`, `CDbl`, `Fix`, `Int`

vbscript – CDate

**FUNCTION:** `CDate(expression)`

**Description**
Convertit une expression date/heure valide en valeur de type Date (Variant subtype Date). L’affichage dépend des paramètres régionaux Windows.

**Syntax**
`CDate(expression)`

**Paramètres**
– `expression` : Chaîne, nombre ou expression représentant une date/heure.

**Retour**
Une valeur de type Date.

**Notes**
– Toujours tester avec `IsDate()` avant de convertir si l’entrée est incertaine.
– Le format final dépend de la locale (format court/long Windows).

**Exemples**
« `vb
Dim anydate
anydate = « June 26, 1943 »
WScript.Echo CDate(anydate)
« `

**Output :** `26.06.1943 (selon locale)`

« `vb
Dim anytime
anytime = « 2:23:59 PM »
WScript.Echo CDate(anytime)
« `

**Output :** `14:23:59 (selon locale)`

**Voir aussi**
`IsDate`, `DateValue`, `TimeValue`, `VarType`

vbscript – CDate

FUNCTION:  CDate( )


Implemented in version 1.0

You can determine the expression subtype by using the function VarType( ).

CDate(Date)

The CDate function converts any valid date and time expression to the variant of subtype Date.

The default date output will be of the format:  **/**/** The default time output will be of the format:  **:**:** *M Converted date values can range from January 1, 100 to December 31, 9999

Code:
<% anydate = « June 26, 1943 » %>
<% =CDate(anydate) %>

Output:
6/26/43

Code:
<% anydate = #6/26/43# %>
<% =CDate(anydate) %>

Output:
6/26/43

Code:
<% anytime= »2:23:59 PM » %>
<% =CDate(anytime) %>

Output:
2:23:59 PM

vbscript – CCur

FUNCTION: CCur( )


Implemented in version 1.0

You can determine the expression subtype by using the function VarType( ).

CCur(Number)

The CCur function converts any number or numeric string to the variant of subtypeCurrency.

Converts to currency values ranging from
-922,337,203,685,477.5808 to 922,337,203,685,477.5807

Code:
<% anynumber=(12345) %>
<% =CCur(any_number) %>

Output:
12345

Code:
<% any_numeric_string=(« 98765 ») %>
<% =CCur(any_numeric_string) %>

Output:
98765

This function rounds off to 4 decimal places.

Code:
<% anynumber=(55555.123456) %>
<% =CCur(anynumber) %>

Output:
55555.1235

vbscript – CByte

FUNCTION:  CByte( )


Implemented in version 1.0

You can determine the expression subtype by using the function VarType( ).

CByte(Number)

The CByte function converts any number between 0 and 255 to the variant of subtypeByte.

Code:
<% anynumber=(9.876) %>
<% =CByte(anynumber) %>

Output:
10

Code:
<% anynumber=(255) %>
<% =CByte(anynumber) %>

Output:
255

vbscript – CBool

FUNCTION:  CBool( )


Implemented in version 1.0

You can determine the expression subtype by using the function VarType( ).

CBool(Number)

The CBool function converts any number to the variant of subtype Boolean.

The output for Boolean is either true or false. If the conversion is successful, the output will be true. If the conversion fails, the output will be false or an error message.

Code:
<% anynumber=7.77 %>
<% =CBool(anynumber) %>

Output:
True

Code:
<% notnumber=abc %>
<% =CBool(notnumber) %>

Output:
False