|
-
Mar 14th, 2001, 08:21 PM
#1
Thread Starter
Lively Member
Greetings..
How could I get the scale of the number of days, hours, minutes, seconds from two different general date format... ie.
11/11/11 11:11 AM and 12/12/12 12:12 AM
will give an output of
1 month
1 day
1 hour
1 minutes
get what i mean??
now how do i write the code..
thanks in advance to those who reply
MohamadHassan<equuelus@icqmail.com>
Javascript,VBScript,ASP,LearningVBfor.NET
ICQ:7205608

-
Mar 15th, 2001, 12:13 AM
#2
Addicted Member
11/11/11 11:11 AM and 12/12/12 12:12 AM
will give an output of
1 month
1 day
1 hour
1 minutes
Do you want the difference between the month parts
Difference between the dateparts and the Difference
Between yearparts.. ....(That will be like what you have written above ...but seems useless..) 
or
You want the exact Number of days,months,Years etc.. between two given dates in different format ?
-
Mar 15th, 2001, 12:26 AM
#3
Thread Starter
Lively Member
yea.. i want the exact no. of hours, days, month, years..ect..between two given dates..
thanks for your reply guru.
MohamadHassan<equuelus@icqmail.com>
Javascript,VBScript,ASP,LearningVBfor.NET
ICQ:7205608

-
Mar 15th, 2001, 05:18 AM
#4
Use the DateDiff function.
-
Mar 15th, 2001, 05:26 AM
#5
Here is the syntax for the DateDiff function.
Syntax
DateDiff(interval, date1, date2[, firstdayofweek[, firstweekofyear]])
The DateDiff function syntax has these named arguments:
Part - 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.
Settings
The interval argument has these settings:
Setting - Description
yyyy - Year
q - Quarter
m - Month
y - Day of year
d - Day
w - Weekday
ww - Week
h - Hour
n - Minute
s - Second
Usage
Code:
?DateDiff("m", "11/11/11", "12/12/12")
-
Mar 15th, 2001, 06:45 AM
#6
Thread Starter
Lively Member
thanks matthew
that was really helpful..emm.. wondering where could i find good reference on built in vb functions plus the syntax..
MohamadHassan<equuelus@icqmail.com>
Javascript,VBScript,ASP,LearningVBfor.NET
ICQ:7205608

-
Mar 15th, 2001, 09:32 AM
#7
If you are using VB, and have it installed along with a help file (or MSDN Libary), everything is listed in there.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|