O'Reilly logo

VB.NET Language in a Nutshell, Second Edition by Steven Roman PhD, Paul Lomax, Ron Petrusha

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required