473,386 Members | 1,810 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,386 software developers and data experts.

Date/Time stamp in SQL

I would like to store a Date/Time stamp in a SQL tabel
Now only the Date is stred and not the time. How to I get the time also

This is the code (There is more, but that works)

atSQLexe ex=new atSQLexe()
ex.addConnection=app.dbConnection
sql="INSERT INTO Log (UserID, Date) VALUES (@UserID, @Date)"
ex.addParm("@UserID",userID)
ex.addParm("@Date", DateTime.Today)
tr

ex.ExecuteSQL(sql)
}
Nov 18 '05 #1
2 1903
Try using

DateTime.Now insted of DateTime.Today

/Kim
"Bert" <an*******@discussions.microsoft.com> skrev i en meddelelse
news:B3**********************************@microsof t.com...
I would like to store a Date/Time stamp in a SQL tabel.
Now only the Date is stred and not the time. How to I get the time also?

This is the code (There is more, but that works):

atSQLexe ex=new atSQLexe();
ex.addConnection=app.dbConnection;
sql="INSERT INTO Log (UserID, Date) VALUES (@UserID, @Date)";
ex.addParm("@UserID",userID);
ex.addParm("@Date", DateTime.Today);
try
{
ex.ExecuteSQL(sql);
}

Nov 18 '05 #2
Bert,
if you have access to the table field definitions, you can set the default
value of the desired field to "getdate()", this retrieves the date/time on
the SQL server automatically, no need to specify manually...
hope this helps...
wardeaux

"Bert" <an*******@discussions.microsoft.com> wrote in message
news:B3**********************************@microsof t.com...
I would like to store a Date/Time stamp in a SQL tabel.
Now only the Date is stred and not the time. How to I get the time also?

This is the code (There is more, but that works):

atSQLexe ex=new atSQLexe();
ex.addConnection=app.dbConnection;
sql="INSERT INTO Log (UserID, Date) VALUES (@UserID, @Date)";
ex.addParm("@UserID",userID);
ex.addParm("@Date", DateTime.Today);
try
{
ex.ExecuteSQL(sql);
}

Nov 18 '05 #3

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

Similar topics

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,...
3
by: fong.yang | last post by:
I have a textbox on my form label date/time. I also added a date/time column to my table as well. The table already contains records before the date/time column was added. How do I setup a...
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...
5
by: Des | last post by:
I have to do an events calender for a church. The events display will be limited to that week. If someone went in today Wed 24th I want to display 21st to 27th. I dont want any code samples, just...
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...
1
by: 6afraidbecause789 | last post by:
Hi - I am using a Date/Time Picker popup form for users to choose a a date and time for use on a separate entry form. The date/time on the entry form is actually entered automatically as a...
16
by: W. eWatson | last post by:
Are there some date and time comparison functions that would compare, say, Is 10/05/05 later than 09/22/02? (or 02/09/22 format, yy/mm/dd) Is 02/11/07 the same as 02/11/07? Is 14:05:18 after...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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:
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.