473,405 Members | 2,379 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,405 software developers and data experts.

DateTime field data extraction

Hi Everyone

Im currently coding a clocking system to monitor hours worked and overtime. I am using C#.Net 2005 and SQL 2005 and i am having a huge issue with the DateTime field.

I want all employees to have a clock in and clock out time, these values are DateTime values however when it saves to the database it includes the date along with the time.

My problem lies in that i use calculations to determine if the employee has worked overtime by using (current time - clock out time), but because it included the date in the database it gives overtime from the day i inserted the employee into the database because it sees this as the clock out.

Is there anyway to extract just the time from the database? Or even make the date the same as the current date (i have tried this but i cannot change the date because it gives me a read only error)

Sorry for the long post. Any help would be greatly appreciated.

And if you need more information just ask and i will give.

Regards Cyril
Aug 23 '07 #1
2 1489
Banfa
9,065 Expert Mod 8TB
Check out the Transact SQL Data and Time functions here. I suggest you may want to use DATEPART.
Aug 23 '07 #2
Thanks for the reply it helped me alot. Really Appreciate it
Aug 27 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Keith | last post by:
I am fairly new to SQL so sorry if this is a really dumb question. I have a small (still) SQL database, which I am trying to query from an ASP page. The field I am querying is of DATETIME data...
3
by: KathyB | last post by:
I'm trying to concatenate fields in SQL stored proc for use in text field in asp.net dropdownlist. I'm running into a problem when I try to use a DateTime field, but can't find the answer (so far)...
2
by: Marcos Rodríguez | last post by:
Hi all I have an Access Data Base containing a table which have a DateTime Field. I am creating a Windows App and I am using a DataGrid object to show data from the table using a DataSet object. My...
0
by: Manny | last post by:
Great that worked! I would also like to only provide a date in the where clause and not a timestamp (the field is of type datetime). I have tried using the date function but it does not appear...
6
by: Paulb1us | last post by:
I want to set a DateTime field to Null before passing it to the DB //First I check to see if anything is in this datarow column, because sometimes we have no data. DateTime dt; if (...
5
by: ad | last post by:
I have a tabls of SQL 2000, about the data of student. The data is migrate from another databse, There is a field called birthday, it stores the data with the formate like: 1994/11/03 AM 02:09:00...
4
by: kd | last post by:
Hi All, I have a datetime column in a table on the SQL database. I need to insert values into the datetime column from vb.net code. Here is my code: dim nameval, str, qry as string nameval =...
5
by: iulian.ilea | last post by:
Is correct to have a varchar field and insert dates of type dd/mm/yyyy into it? I choose this method because I have an application that runs on more than one server. So, if I used a datetime field...
4
by: =?Utf-8?B?QmFidU1hbg==?= | last post by:
Hi, I have a GridView and a SqlDataSource controls on a page. The SqlDataSource object uses stored procedures to do the CRUD operations. The DataSource has three columns one of which -...
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: 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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.