List of free web storage providers. Save up to 50 GB online.

Period of time between two different dates
 
 
Code Result
I was borned on 1/1/1900. How old I am? 
<% Mydate="1/1/1900" %>
Years form <% =Mydate %>: <% =DateDiff("yyyy", Mydate, Date) %>
I was borned on 1/1/1900. How old I am?
Years form1/1/1900: 108
I had an accident on 30/11/2001. 
How many days I have been sleeping?
<% Mydate="30/11/2001" %>
Days form <% =Mydate %>: <% =DateDiff("D", Mydate, Date) %>
 
I had an accident on 30/11/2001. 
How many days I have been sleeping?
Days form30/11/2001: 2352
Days in next 6 years: 
<% =DateDiff("D", Date, dateAdd ("yyyy",6,Date)) %>
Days in next 6 years: 
2191
<% Mydate="4/9/2005" %>
Days form now to <% =Mydate %>: <% =DateDiff("D", Date, Mydate) %>
Days form now to 4/9/2005: -1126
Seconds since midnight: <% =Timer %> Seconds since midnight: 70487.95

Date intervals constants used in the table above and some more.

Time period Constant
Year "yyyy"
Quarter "q"
Month "m"
Day of year "y"
Day "D"
Weekday "w"
Week of the year "ww"
Hour "h"
Minute "n"
Second "s"

 

Create word search puzzles with your own words



Add Country identification to your site

Tutorial home page

2008@ AspTutorial.info. All rights reserved.