Computer room charges to do on the machine and the next part, the need to calculate from the machine to the time difference between the machine, so as to calculate the costs incurred during the machine.
At this time, you can use a function can be simple to implement--datediff (), the specific use of rules:
DateDiff (Timeinterval,date1,date2 [, FirstDayOfWeek [, FirstWeekOfYear]])
The return value of the function is the time elapsed from Date1 to Date2, timeinterval the type that represents the time interval (that is, the unit of measure of Time), respectively:
Year yyyy
Quarter Q
Month m
One day of the year Y
Date D
Week WW
Hour h
Min n
Seconds s
Millisecond MS
An example is provided:
Example: DateDiff ("Q", #1991 -01-01#, #1992 -01-01#) returns 4
DateDiff ("yyyy", #1991 -01-01#, #2000 -01-01#) returns 9
DateDiff ("n", #06:00:00#, #07:05:04#) return 65
DateDiff ("H", #06:00:00#, #07:05:04#) return 1
......
Back to the column page: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/vb/