473,385 Members | 1,925 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Time Stamp

I am pretty new at this so please bare with me.

I have a page working perfectly but I just want to ad a column that will
show the time it was entered into the database. I think all I need is the
syntax for writing the server time to the TimeStamp field in the record. I
have hidden field in the form that I alocated. So how do I get it to write
the current time to the database. Here is the current code:
<form name="form1" method="POST" action="<%=MM_editAction%>">
<table width="500" cellpadding="2" cellspacing="0">
<tr>
<td width="242" class="tdtl">Are you coming to the lake this weekend?
</td>
<td width="244" class="tdtr"><input name="Answer" type="radio"
value="Yes" checked>
Yes&nbsp;&nbsp;&nbsp; <input name="Answer" type="radio"
value="No">
No</td>
</tr>
<tr>
<td class="tdleft">Your Name Please </td>
<td class="tdright"><input name="Name" type="text" id="Name"
size="40"></td>
</tr>
<tr>
<td class="tdleft">I will be arriving on . . . </td>
<td class="tdright"><select name="Arriving" size="1" id="Arriving">
<option value="Cant make it">Cant make it</option>
<option value="Friday">Friday</option>
<option value="Saturday">Saturday</option>
<option value="Sunday">Sunday</option>
<option value="Monday">Monday</option>
<option value="Tuesday">Tuesday</option>
<option value="Wednesday">Wednesday</option>
<option value="Thursday">Thursday</option>
</select></td>
</tr>
<tr>
<td class="tdleft">Boathouse</td>
<td class="tdright"><input name="BoatHouse" type="text" id="BoatHouse"
size="6" maxlength="6">&nbsp;&nbsp; </td>
</tr>
<tr align="center">
<td colspan="2" class="tdleft"><input name="Submit" type="submit"
onClick="MM_validateForm('Name','','R');return document.MM_returnValue"
value="Submit"></td>
</tr>
</table>

<input type="hidden" name="MM_insert" value="form1">
<span class="tdright">
<input name="TimeStamp" type="hidden" id="TimeStamp"
value="<%=(rsList.Fields.Item("TimeStamp").value)% >">
</span>
</form>

Is it this last "Input" statement that I need to change to get this to work
right?

Thanks

Houston
Jul 20 '05 #1
2 2121
Hi Houston,

wouldn't it be a lot easier to set the timestamp right in the sql-query?
You could even set up a datetime-column with default-value getdate().
Sample (suggestion, not that I say that I'd do it that way, but accoring
to your html):

CREATE TABLE lakeweekend
(
lw_id int identity(1,1) primary key,
Answer varchar(10),
Arriving varchar(20),
[Name] varchar(100) not null,
lw_inserted datetime default getdate()
)

(some columns left out for the sample)

You could then enter the data like this (just leaving the
timestamp-column away):

insert into lakeweekend ([Name]) values ('Test')

if you do a
select * from lakeweekend
you can see that the current date has been inserted into lw_inserted

I'm not an ASP-programmer so I just gave you some sql-snipplets (they
should work on SQLServer 2000).

hth,

Tobias

Houston wrote:
I am pretty new at this so please bare with me.

I have a page working perfectly but I just want to ad a column that will
show the time it was entered into the database. I think all I need is the
syntax for writing the server time to the TimeStamp field in the record. I
have hidden field in the form that I alocated. So how do I get it to write
the current time to the database. Here is the current code:
<form name="form1" method="POST" action="<%=MM_editAction%>">
<table width="500" cellpadding="2" cellspacing="0">
<tr>
<td width="242" class="tdtl">Are you coming to the lake this weekend?
</td>
<td width="244" class="tdtr"><input name="Answer" type="radio"
value="Yes" checked>
Yes&nbsp;&nbsp;&nbsp; <input name="Answer" type="radio"
value="No">
No</td>
</tr>
<tr>
<td class="tdleft">Your Name Please </td>
<td class="tdright"><input name="Name" type="text" id="Name"
size="40"></td>
</tr>
<tr>
<td class="tdleft">I will be arriving on . . . </td>
<td class="tdright"><select name="Arriving" size="1" id="Arriving">
<option value="Cant make it">Cant make it</option>
<option value="Friday">Friday</option>
<option value="Saturday">Saturday</option>
<option value="Sunday">Sunday</option>
<option value="Monday">Monday</option>
<option value="Tuesday">Tuesday</option>
<option value="Wednesday">Wednesday</option>
<option value="Thursday">Thursday</option>
</select></td>
</tr>
<tr>
<td class="tdleft">Boathouse</td>
<td class="tdright"><input name="BoatHouse" type="text" id="BoatHouse"
size="6" maxlength="6">&nbsp;&nbsp; </td>
</tr>
<tr align="center">
<td colspan="2" class="tdleft"><input name="Submit" type="submit"
onClick="MM_validateForm('Name','','R');return document.MM_returnValue"
value="Submit"></td>
</tr>
</table>

<input type="hidden" name="MM_insert" value="form1">
<span class="tdright">
<input name="TimeStamp" type="hidden" id="TimeStamp"
value="<%=(rsList.Fields.Item("TimeStamp").value)% >">
</span>
</form>

Is it this last "Input" statement that I need to change to get this to work
right?

Thanks

Houston

Jul 20 '05 #2
I appreciate your help, I ended up just putting in a Hidden field and had it
write the current time into the "TimeLog" column of an access database using
"Value = <% NOW() %>" Works great

Thanks again.
"Tobias Marquart" <to******@gmx.de> wrote in message
news:41********@maser.urz.unibas.ch...
Hi Houston,

wouldn't it be a lot easier to set the timestamp right in the sql-query?
You could even set up a datetime-column with default-value getdate().
Sample (suggestion, not that I say that I'd do it that way, but accoring
to your html):

CREATE TABLE lakeweekend
(
lw_id int identity(1,1) primary key,
Answer varchar(10),
Arriving varchar(20),
[Name] varchar(100) not null,
lw_inserted datetime default getdate()
)

(some columns left out for the sample)

You could then enter the data like this (just leaving the
timestamp-column away):

insert into lakeweekend ([Name]) values ('Test')

if you do a
select * from lakeweekend
you can see that the current date has been inserted into lw_inserted

I'm not an ASP-programmer so I just gave you some sql-snipplets (they
should work on SQLServer 2000).

hth,

Tobias

Houston wrote:
I am pretty new at this so please bare with me.

I have a page working perfectly but I just want to ad a column that will
show the time it was entered into the database. I think all I need is the syntax for writing the server time to the TimeStamp field in the record. I have hidden field in the form that I alocated. So how do I get it to write the current time to the database. Here is the current code:
<form name="form1" method="POST" action="<%=MM_editAction%>">
<table width="500" cellpadding="2" cellspacing="0">
<tr>
<td width="242" class="tdtl">Are you coming to the lake this weekend? </td>
<td width="244" class="tdtr"><input name="Answer" type="radio"
value="Yes" checked>
Yes&nbsp;&nbsp;&nbsp; <input name="Answer" type="radio"
value="No">
No</td>
</tr>
<tr>
<td class="tdleft">Your Name Please </td>
<td class="tdright"><input name="Name" type="text" id="Name"
size="40"></td>
</tr>
<tr>
<td class="tdleft">I will be arriving on . . . </td>
<td class="tdright"><select name="Arriving" size="1" id="Arriving"> <option value="Cant make it">Cant make it</option>
<option value="Friday">Friday</option>
<option value="Saturday">Saturday</option>
<option value="Sunday">Sunday</option>
<option value="Monday">Monday</option>
<option value="Tuesday">Tuesday</option>
<option value="Wednesday">Wednesday</option>
<option value="Thursday">Thursday</option>
</select></td>
</tr>
<tr>
<td class="tdleft">Boathouse</td>
<td class="tdright"><input name="BoatHouse" type="text" id="BoatHouse" size="6" maxlength="6">&nbsp;&nbsp; </td>
</tr>
<tr align="center">
<td colspan="2" class="tdleft"><input name="Submit" type="submit"
onClick="MM_validateForm('Name','','R');return document.MM_returnValue"
value="Submit"></td>
</tr>
</table>

<input type="hidden" name="MM_insert" value="form1">
<span class="tdright">
<input name="TimeStamp" type="hidden" id="TimeStamp"
value="<%=(rsList.Fields.Item("TimeStamp").value)% >">
</span>
</form>

Is it this last "Input" statement that I need to change to get this to work right?

Thanks

Houston

Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Yang Li Ke | last post by:
Hi guys, Im about to build a script which will log visitor time spent on my website. I got a few ideas about this, maybe checking visitors ip and storing that info in db with time in and then...
5
by: akoper | last post by:
I have a table that is a project. Each record is a task in the project. One field in each record is a date/time stamp for when that task was completed. I need to be able to: 1) compute how much...
7
by: Don | last post by:
Hi all, With regards to the following, how do I append the datetimestamp to the filenames in the form? The files are processed using the PHP script that follows below. Thanks in advance,...
4
by: luscus | last post by:
I am trying to device a formula so that when i check of a yes/no box (done) it will automatically add the time in a field called "End Time" and at the same time stamp the amount of minutes...
2
by: David Berman | last post by:
Suppose you have a bulletin board where of course people can post messages and read messages composed by other people. Each message has a time stamp on it. When someone in California comes to the...
6
by: Mike Charney | last post by:
Is there a way to check a files date and time stamp from VBA in access. I have a need check a date stamp on a file that I am importing. Thanks in advance, Mike m charney at dunlap hospital...
3
by: phried1 | last post by:
I have created a form and inserted the following tables: Date Entered Time Entered Date Modified Time Modified Essentially how and where can I have these dates and times recorded so when the...
1
by: Susan Bricker | last post by:
Greetings. I have a report (actually all of my reports in an MDB) that I want to date/time stamp at the bottom. Previously, I had used the builtin function of Now(). I thought that would give...
4
by: SilentThunderer | last post by:
Hey folks, Let me start out by letting you know what I'm working with. I'm building an application in VB 2005 that is basically a userform that employees can use to "Clock in". The form...
2
by: Shane | last post by:
I'm writing a program for renaming my picture files, and I want to use the picture time stamp as a prefix to the file names. I can get the time stamp, but it is extraordinarily slow! I have about...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.