homecode zoneQuick Codedownloadssubmit codeabout usfeedbackscontact ussitemap
 
Beginners
Database
File System Object
General
Graphics
Multimedia
Networking
Shell Object
Timer
Array
Date/Time
Declaration
Error Handling
File/Folder
Logic
Loops & Conditional
Math
Miscellaneous
Strings
Values
Pro - Languages
C/C++
Java
Visual basic
asp
vb.net 2003/2005
asp.net
Quick Code
SUBMIT CODE
Mail List
LINKS
Submit LINK
 
ProgrammerGuide.net - VB Date-Time.
Home » VB Zone » Date/Time

Date

Returns a Variant (Date) containing the current system date.
Syntax: Date

Remarks
To set the system date, use the Date statement.
Date, and if the calendar is Gregorian, Date$ behavior is unchanged by the Calendar property setting. If the calendar is Hijri, Date$ returns a 10-character string of the form mm-dd-yyyy, where mm (01-12), dd (01-30) and yyyy (1400-1523) are the Hijri month, day and year. The equivalent Gregorian range is Jan 1, 1980 through Dec 31, 2099.

Example:

Dim s as Date
S = Date
Label1 = s

Time

Sets the system time.
Syntax: Time = time
The required time argument is any numeric expression, string expression, or any combination, that can represent a time.

Remarks
If time is a string, Time attempts to convert it to a time using the time separators you specified for your system. If it can't be converted to a valid time, an error occurs.

Example:
Private Sub Form_Load()
Label1 = Time
End Sub

Now

Returns a Variant (Date) specifying the current date and time according your computer's system date and time.
Syntax: Now

Example:
Private Sub Form_Load()
Dim s As Date
s = Now
Label1 = s
End Sub
‘Displays the date and time in label1

Timer

Timers execute code repeatedly according to the Interval you specify. Set the Interval property in milliseconds. For example, 2000 = 2 seconds. Timers are useful for checking programs conditions periodically, but don't get in the habit of using them for everything. A Timer control is not a clock and should not be relied upon to keep accurate time.

DateAdd

Returns a Variant (Date) containing a date to which a specified time interval has been added.
Syntax: DateAdd(interval, number, date)

The DateAdd function syntax has these named arguments:

Part Description
interval Required. String expression Required. String expression that is the interval of time you want to Add.
number Required. Numeric expression that is the number of intervals you want to add. It can be positive (to get dates in the future) or negative (to get dates in the past).
date Required. Variant (Date) or literal representing date to which the interval is added

Settings
The interval argument has these settings:

Setting Description
yyyy Year
q Quarter


« Previous 1 2 3 4 Next »

Viewers: 15
Visitors:127291
Last Updated on:Sunday, January 17, 2010
Home | About us | Feedback | Contact us | Sitemap
Copyright © 2008 ProgrammerGuide.net. All rights reserved.
This site is best viewed in IE 6.0, Firefox 1.5 and above with screen resolution of 1024 X 768.