Mega Code Archive
Search
.Net
ASP .Net
ASP .Net Tutorial
C#
C# Book
C# by API
C# Tutorial
VB.Net
VB.Net by API
VB.Net Tutorial
Visual C++ .Net
VisualBasic Script
Java
Java
Java Book
Java by API
Java Tutorial
Script
Flash ActionScript
Flex
JavaScript DHTML
JavaScript Reference
JavaScript Tutorial
Database
MSSQL
MSSQL Tutorial
MySQL
MySQL Tutorial
Oracle PLSQL
Oracle PLSQL Tutorial
PostgreSQL
Languages
Android
C
C Tutorial
C++
C++ Tutorial
Delphi
Perl
PHP
Python
Python Tutorial
Ruby
Silverlight
Office
MSOfficeExcel 2007 Tutorial
MSOfficePowerPoint 2007 Tutorial
MSOfficeWord 2007 Tutorial
Data
XML
XML Tutorial
VisualBasic Script
Date Functions 142 codes
Home
VisualBasic Script
Date Functions
1 A destroying the old values by using the Preserve keyword
2 Aaaa - Displays the full, localized name of the day
3 Add value to Date
4 AMPM - Uses the 12-hour clock and displays AM or PM as appropriate
5 AMPM - Uses the 12-hour clock and displays the AM or PM string literal defined for the system
6 AP - Uses the 12-hour clock and displays A or P as appropriate
7 Break a single date down to its individual components using the DatePart function
8 C - Displays the date
9 Characters for Creating Your Own Number Formats
10 Currency
11 Currency - The number is displayed with two decimal places, a thousand separator, and the currency symbol appropriate to th
12 D - Displays the date (1 to 31) without a leading zero for single-digit numbers
13 Date and Now
14 Date returns a VariantDate containing the current date according to your computer
15 Date separator (also locale-dependent)
16 DateAdd returns the result of adding or subtracting a specified period of time to a date
17 DateAdd(interval, number, date) returns a VariantDate containing the date of the specified interval after the specified dat
18 DateDiff returns the interval of time between two dates
19 DateDiff() function returns the difference between two dates The unit for the difference is specified as a string ( s for s
20 DateDiff(interval, date1, date2[, firstdayofweek[, firstweekofyear]]) returns the interval between two specified dates
21 DateDiff(m, 3152000, Now)
22 DateDiff(m, Now, 101003)
23 DateDiff(yyyy, Now, 101003)
24 DatePart returns Prints the Year
25 DatePart(d, Now)
26 DatePart(h, Now)
27 DatePart(m, Now)
28 DatePart(n, Now)
29 DatePart(q, Now)
30 DatePart(s, Now)
31 DatePart(w, Now)
32 DatePart(ww, Now)
33 DateSerial(4, 11, 23) returns 11232004
34 DateSerial(year, month, day) returns a VariantDate containing the date for the specified year, month, and day
35 DateValue(date) returns a VariantDate containing the specified date
36 DateValue(Nov, 23 04) returns 11232004
37 Day(Date)
38 Day(date) returns a VariantInteger between 1 and 31, inclusive, representing the day of the month for date
39 Dd - Displays the date with a leading zero for single-digit numbers (01 to 31)
40 Ddd - Displays the day as a three-letter abbreviation (Sun, Mon, Tue, Wed, Thu, Fri, Sat) with no period
41 Dddd - Displays the full name of the day
42 Ddddd - Displays the complete date (day, month, and year) in the systems short date format
43 Dddddd - Displays the complete date (day, month, and year) in the systems long date format
44 Declaring and Working with Dynamic Arrays
45 Delivery Date Maint
46 Difference between two dates in days and months
47 Dynamic Arrays
48 Fixed - The number is displayed with two decimal places and at least one integer place
49 For example, the following statement returns Saturday, April 01, 2006
50 Format Demo
51 Format the date type value
52 Format time as mmmm_yyyy
53 Format(datDateTime, dd mmm yy)
54 Format(datDateTime, Long Date)
55 Format(datDateTime, mm dddd hh
56 Format(datDateTime, yyyy-mm-dd)
57 Format(dblNumber #####0)
58 Format(dblNumber ###,##0 00)
59 Format(dblNumber 0 00)
60 Format(dblNumber 000000 00)
61 Format(Now, ddd)
62 Format(Now, dddd)
63 Format(Now, ddddd)
64 Format(Now, dddddd)
65 Format(Now, d-mmmm-yy)
66 Format(Now, d-mmm-yy)
67 Format(Now, Hh
68 Format(Now, mmmm d, yyyy)
69 Format(Now, ttttt)
70 Formatting the date and time with format function
71 General Number - The number is displayed with no thousand separator
72 Get the weekend between startDate and endDate
73 H - Displays a number from 0 to 23 giving the hour
74 Hh - Displays a number from 00 to 23 giving the two-digit hour
75 Hour(time) returns VariantInteger between 0 and 23, inclusive, representing the hour for time
76 M - Displays an integer from 1 to 12 giving the number of the month without a leading zero on single-digit months
77 Mm - Displays a number from 01 to 12 giving the two-digit number of the month When used after h returns minutes instead of
78 Mmm - Displays the month as a three-letter abbreviation (except for May) without a period
79 Mmmm - Displays the full name of the month
80 MonthName returns the text string associated with a month number
81 MonthName(Month(Date))
82 MonthName(Month(Date), True)
83 MonthName(month) returns A String containing the name of the month represented by month
84 N - Displays a number from 0 to 60 giving the minute
85 Nn - Displays a number from 00 to 60 giving the two-digit minute
86 Now returns a VariantDate containing the current date and time according to your computer
87 OnOff - A non-zero number is displayed as On; a zero number is displayed as Off
88 Oooo - Displays the full localized name of the month
89 Percent - The number is displayed multiplied by 100, with two decimal places, and with a percent sign
90 Prints the Day of the Year
91 Prints the Month Number
92 Prints the Quarter Number
93 Prints the Week of the Year
94 Program an event for 3
95 Q - Displays a number from 1 to 4 giving the quarter of the year
96 Returns a currency formatted with four decimal places
97 Returns the number of weeks between June 3, 2006 and September 30, 2006
98 S - Displays a number from 0 to 60 giving the second
99 Scheduling a Macro to Run x Minutes in the Future
100 Scheduling a Verbal Reminder
101 Scientific - The number is displayed in scientific notation
102 Second(time) returns A VariantInteger between 0 and 59, inclusive, representing the second for time
103 Ss - Displays a number from 00 to 60 giving the two-digit second
104 Standard - The number is displayed with two decimal places, at least one integer place, and a thousand separator (when need
105 The Currency data type allows for positive and negative numbers with up to 15 digits to the left of the decimal point and 4
106 The Weekday function values
107 Theres a potential problem when you try to resize the array
108 Timer returns a Single giving the number of seconds that have elapsed since midnight
109 TimerValue function returns time value
110 TimeSerial(9, 0, 0) returns 9
111 TimeSerial(hour, minute, second) returns a VariantDate containing the time for the specified hour, minute, and second
112 TimeValue(9
113 TimeValue(time) returns A VariantDate containing the time for time
114 To schedule an event relative to the current time - for example, 20 minutes from now
115 Transpose() sub procedure is using a dynamic array that is re-dimensioned with two dimensions
116 TrueFalse - A non-zero number is displayed as True; a zero number is displayed as False
117 Ttttt - Displays the full time (hour, minute, and second) in the systems default time format
118 Use DateDiff function
119 Use DateSerial and Weekday
120 Use Hour to get the hour value from a date
121 Use Now to retrieve current Date and Time
122 Use ReDim to create dynamic array
123 Use the OnTime method to run a VBA procedure on a particular day
124 Use the Preserve keyword to keep the values
125 Use Weekday to get the weekday value from a date
126 Use year function to get the year
127 Using a Dynamic Array
128 Using DatePart(interval, date[,firstdayofweek[, firstweekofyear]]) to Parse Dates
129 Using the Format Function to Format an Expression
130 VBA Date function and the Mod operator
131 W - Displays an integer from 1 (Sunday) to 7 (Monday) containing the day of the week
132 Weekday(Date)
133 Weekday(date) returns A VariantInteger containing the day of the week represented by date
134 WeekdayName (weekday) returns A String containing the weekday denoted by weekday
135 WeekdayName(Weekday(Date))
136 WeekdayName(Weekday(Date), True)
137 Ww - Displays an integer from 1 to 54 giving the number of the week in the year
138 Y - Displays an integer from 1 to 366 giving the day of the year
139 Year(Date)
140 YesNo - A non-zero number is displayed as Yes; a zero number is displayed as No
141 Yy - Displays a number from 00 to 99 giving the two-digit year
142 Yyyy - Displays a number from 0100 to 9999 giving the four-digit year