You are currently browsing the tag archive for the 'tutorial' tag.
Add time period to date
In the table the actual servers date is shown(first part of the table), and bellow we have add diferent intervals of times to actual date. The new date has been saved to a variable named Mydate and date, year, month, monthname, day, and weekday corresponding to Mydate has been shown in each line .
This kind of code may be useful to display the correct date corresponding to a country or region when the server is located in a different country (for example, the server is located in US, and the visitors are from Spain)
date Year Month MonthName Day Weekday
The actual date
9/13/2008
2008
9
September
13
7
Add a time period to actual date
Add 3 years to actual date:
9/13/2011 2011 9 September 13 3
Add 3 quarters to actual date:
6/13/2009 2009 6 June 13 7
Add 3 months to actual date:
12/13/2008 2008 12 December 13 7
Add 3 days to actual date:
9/16/2008 2008 9 September 16 3
Add 24 hours to actual date:
9/13/2008 3:00:00 AM 2008 9 September 13 7
Add 1440 minutes to actual date:
9/13/2008 12:03:00 AM 2008 9 September 13 7
Add 86400 seconds to actual date:
9/13/2008 12:00:03 AM 2008 9 September 13 7
http://www.asptutorial.info/sscript/Addtimeperiodtodate.html
Recordset.Move()
The Recordset.Move() technique was the first example I ever posted in this article. In an attempt to eliminate the need for heavy recordset objects, I decided to try the Move() method to skip the first n rows in the resultset to start at the first row for the page we are interested in.
<%
rstart = PerPage * Pagenum – (PerPage – 1)
dataSQL = “SELECT ArtistName, Title FROM SampleCDs WITH (NOLOCK)”
set rs = conn.execute(dataSQL)
if not rs.eof then
rs.move(rstart-1)
response.write “
| “ response.write artist & “ |
“ else response.write “ |
| “ end if response.write title & “ |
“
else
response.write “No rows found.”
response.end
end if
%>
This code can be found at:
http://databases.aspfaq.com/database/how-do-i-page-through-a-recordset.html
