14 th Dec 2019 17:52:19
Hai Friend , Sign In
Chennai City
IP 2 Location
G. K.
Tamil Nadu Government Holiday List 2018 in English and Tamil   *   Trichy: Wanted - PHP, MySql Programmers. Contact trichy people only 84894 28 444.   *   Indian Railways New Train Number List [Search / Enquiry / Locator / Finder]   *   பன்றிக் காய்ச்சல் பற்றி அறிந்து கொள்ளுங்கள் (Swine Flu H1N1)
See Also
DateAdd Function DateAdd Function
DatePart Function DatePart Function
Date Time Functions Date Time Functions
Visual Basic Functions Visual Basic Functions
Visual Basic Home Visual Basic Home
Description  Syntax  Return Datatype  Example  Migration

DateDiff Function - Visual Basic 6.0 (VB 6.0)

Returns a Variant (Long) specifying the number of time intervals between two specified dates.
DateDiff(interval, date1, date2[, firstdayofweek[, firstweekofyear]])
Parameter Description
interval Required. String expression that is the interval of time you use to calculate the difference between date1 and date2.
date1, date2 Required; Variant (Date). Two dates you want to use in the calculation.
firstdayofweek Optional. A constant that specifies the first day of the week. If not specified, Sunday is assumed.
firstweekofyear Optional. A constant that specifies the first week of the year. If not specified, the first week is assumed to be the week in which January 1 occurs.

DateDiff Function intervals:

Interval Strings Description
s Second
n Minute
h Hour
d Day
m Month
yyyy Year
y Day of year
q Quarter
ww Week of year
w Weekday
Note: To calculate the number of days between date1 and date2, you can use either Day of year ("y") or Day ("d").

firstdayofweek Constants:

Constant Value Description
vbUseSystem 0 Use the NLS API setting.
vbSunday 1 Sunday (default)
vbMonday 2 Monday
vbTuesday 3 Tuesday
vbWednesday 4 Wednesday
vbThursday 5 Thursday
vbFriday 6 vbFriday
vbSaturday 7 Saturday

firstweekofyear Constants:

Constant Value Description
vbUseSystem 0 Use the NLS API setting.
vbFirstJan1 1 Start with week in which January 1 occurs (default).
vbFirstFourDays 2 Start with the first week that has at least four days in the new year.
vbFirstFullWeek 3 Start with first full week of the year.
Return Data type:

Statement Result Remark
DateDiff("s", Now, Now + 1) 86400  
DateDiff("n", Now, Now + 1) 1440  
DateDiff("h", Now, Now + 1) 24  
DateDiff("d", Now, Now + 1) 1  
DateDiff("m", Now, Now + 60) 2  
DateDiff("yyyy", Now, Now + 365) 1  
DateDiff("y", Now, Now + 10) 10  
DateDiff("q", Now, Now + 365) 4  
DateDiff("ww", Now, Now + 365) 52  
DateDiff("w", Now, Now + 365) 52  
DateDiff("d", Now + 1, Now) -1  
Go to top

Migration from Visual Basic 6.0 (VB 6.0) to
  DateDiff Function in VB Script (VBS)
  DateDiff Function in JScript (JS)
  DateDiff Function in ASP (Active Server Page)
  DateDiff Function in PHP Script
  DateDiff Function in MS-Access
  DateDiff Function in MS SQL Server
  DateDiff Function in Oracle
  DateDiff Function in C Language
  DateDiff Function in C++ Language
  DateDiff Function in Foxpro
  DateDiff Function in Fortran
  DateDiff Function in MS Excel Sheet
Go to top

© 2005 - 2007 Chennaiiq.com. All Rights Reserved.

Our Sites: ChennaiIQ.com || Tamil Calendar || Tamil Panchangam || KP Astrology
Our Blogs: Tamil Calendar