ASP.NET and Several Methods for Updating a Last Modified Date

By: Joann Lavrich

Page 1 of 4

Set for printing

Next

Created On and Last Modified dates are commonly included objects on web pages.   This can be quite useful in determining when the last time content was added to a website.   On the other hand, it may be beneficial to the user or administrator to know when the information within the page itself (i.e., forms) either being entered or modified. Tracking changes to a web page can be from a variety of sources. In the following article these methods will be discussed: setting the last modified in Dreamweaver; using SQL queries to return the last modified date or current date; using the DateTime object; and setting the file timestamps in code.

Setting the Last Modified in Dreamweaver

Dreamweaver has a date object built in to it that can be easily used to keep track of when the page was modified within Dreamweaver itself. This object may be formatted in any way that is desired and allows the inclusion of the time as well as the day. In addition, it may be set to automatically update when the page is saved. To set the Last modified in the page within Dreamweaver:

  1. Place the cursor where the desired location is and type "Last Modified: " or whatever the desired verbiage is.
  2. Select the Insert Date button  from the toolbar.

    DW toolbar

  3. In the Insert Date dialog box, choose the appropriate format for the date and time. Make sure to select the checkbox for Update automatically on save. Dreamweaver will then automatically modify the date and time every time the file is edited and saved. If this checkbox is not selected, the date value inserted will be static text set to whatever day and time the object was inserted.

    Insert Date dialog

  4. Click OK.

The HTML code looks something like this:

<p>Last Modified: 
 <!--#BeginDate format:fcEn2a -->
  Tuesday, 27-Jun-2006 6:42 PM
 <!-- #EndDate-->
</p>

 And  the corresponding page will have the following in it:

The inserted date displayed in a browser.

Page 1 of 4 1 2 3 4 Next


download
Download Support Files


Downloads are disabled during your trial period.


Keywords
created, modified, .net, date, C#, VB, asp.net, timestamp, Dreamweaver, SQL, CURRENT_DATE, CURRENT_TIME, CURRENT_TIMESTAMP, DateTime, FileInfo, file attributes