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;FirstDayOfWeekenumeration) A constant that specifies the first day of the week
-
weekofyear(optional;FirstWeekOfYearenumeration) 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
stylecan 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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access