Name

Format Function

Class

Microsoft.VisualBasic.Strings

Syntax

Format(expression[, style[, dayofweek[, _
       weekofyear]]])
expression (required; String/Numeric)

Any valid string or numeric expression

style (optional; String)

A valid named or user-defined format expression

dayofweek (optional; FirstDayOfWeek enumeration)

A constant that specifies the first day of the week

weekofyear (optional; FirstWeekOfYear enumeration)

A constant that specifies the first week of the year

First Day of Week Constants

Constant

Value

Description

System

0

NLS API setting

Sunday

1

Sunday (default)

Monday

2

Monday

Tuesday

3

Tuesday

Wednesday

4

Wednesday

Thursday

5

Thursday

Friday

6

Friday

Saturday

7

Saturday

First Week of Year Constants

Constant

Value

Description

UseSystemDayOfWeek

0

Use the NLS API setting.

FirstJan1

1

Start with the week in which January 1 occurs (default).

FirstFourDays

2

Start with the first week that has at least four days in the new year.

FirstFullWeek

3

Start with first full week of the year.

Return Value

A string containing the formatted expression

Description

Allows you to use either predefined or user-defined formats to output string, numeric, and date/time data

Rules at a Glance

  • style can be either a predefined or user-defined format.

  • User-defined formats for numeric values are created with up to four sections, delimited by semicolons. Each section is used for a different type of numeric value. The four possible sections are shown in the following ...

Get VB.NET Language in a Nutshell, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.