date/time or date and time

I am setting up an SQL database and I will need to get differences in dates. For example I have a start date, start time, completion date and completion time and I want to get the difference between the start and completion.

Would it be better to have one field with both date and time in it, or better to have a date field and a time field?
Even though I have already started setting up the tables with seperate fields for date and time I am now leaning toward one field with date/time in it. (Only because that is the way I had to do it when setting up an Excel spreadsheet for a similar task)
When that is decided could someone please point me to a good resource for explaining to me the iConvertible method. I tried a simple asp.net page to insert a record into the database and got an error method telling me I had to use the iConvertible method. (I am programming in C#). I use a textbox on a webform to input the date and time information and the SQL database fields are set up as date/time. I looked at the visual studio documentation but that doesn't help me much. It doesn't show me the syntax required and how to "use" the method.
Thanks
0
studiojp
2/20/2004 1:50:51 AM
asp.net.sql-datasource 29906 articles. 0 followers. Follow

2 Replies
955 Views

Similar Articles

[PageSpeed] 38

one field with datetime should be good...easier for maintenance too..and it will solve your puspose too...

** no idea abt iConvertible...sorry
hth
***********************
Dinakar Nethi
Life is short. Enjoy it.
***********************
0
ndinakar
2/20/2004 2:38:20 AM
You can use DataType as DateTime and to get the difference between the Dates you can use the DateTime.Subtract()
Sushila Bowalekar Patel
Visual ASP/ASP.NET MVP
http://weblogs.asp.net/sushilasb
0
SushilaSB
2/20/2004 2:51:37 AM
Reply:

Similar Artilces:

java date time and utc date time
hi i have a client written in delphi the backend is written in java (webservice) when fetching a date field from the db, through java to delphi (TXSDateTime class), for some reason the date changes. in the db: 30/07/2009 00:00:00 in delphi: xsdatetime.asdatetime = 29/07/2009 23:00:00 (1 hour before) in delphi xsdatetime.asutcdatetime = 29/07/2009 21:00:00 (3 hours before) i guess it's a matter of timezones but all we want is simply to fetch the same date as it appears in the DB what are we missing? thanks amos szust wrote: > hi > > i have a client written in d...

just Time or date portion of a date/time field
Good Day, From a DateTime data column how do I get just a Time portin or just a date portion of data to be displayed. i.e from 11/6/2003 10:03:20 AM I need to display date and time seperately in my data display page. Thanks Regards, In code you could use Dim dt as System.Date Dim day, month, year as integer day = dt.Day month= dt.Month year = dt.Year This also works with DateTime In SQL you could use DATEPART(<datepart>,<datetime>) where <datepart> is the abbreviations mentioned in post 385301 and <datetime> is a...

Formatting date SQL date to remove time
Hi,I need a way of changing the following SQL statement so that the dates are without the hh:mm:ss tt:"Select DISTINCT([StartDate]) From [Events]"How can this be done?Thanks,Curt. Regards, Curt SELECT CONVERT (VARCHAR, [StartDate], 101) FROM ... For other date formatting types, see http://msdn2.microsoft.com/en-us/library/ms187928.aspxMark replies as answers if they helped you solve the problem. use the following Conversions Convert("urdatecolumn",Varchar,101); and there are more codes for the dateconversions.Its general Syntax is Convert("urdatecolumn",...

Adding time for past dates dates or correcting a time entry
Hi all, We are using Bugzilla to record time spent on bugs. Is there a way for a person to add time on a previous date? Or is there a way to correct an entry? I can access the DB by an ODBC connector, but I'm reluctant to change the date in bugs_activity table. Thanks Sanjay On Jul 29, 3:58=A0pm, Sanjay Jain <sanjayjai...@gmail.com> wrote: > Hi all, > > We are using Bugzilla to record time spent on bugs. Is there a way for > a person to add time on a previous date? > > Or is there a way to correct an entry? > > I can access the DB by...

Compare file modified date time to system date time
I have an client application that uploads a zip file to a server. Once the server application sees the file, it processes the file. The process starts before the zip file is completely downloaded to the server. I want to delay the process until the file is completely downloaded. I am trying to compare the zip file modified date time with the system date time. If the zip file modified date time is 5 seconds older than the system date time then I know the zip file downloaded. At this point I will continue to process the zip file. I am not sure how I can compare the two date time. The DateTime....

Server Date & Time vs. Local Date & Time
I have the following code (which some members assisted with) and it works great locally... It takes the date and time and formats just the way I want:  e.g.:  10/28/2008 13:58:44 becomes 102820080158 (which is what I want) But, when I upload the app to our server the date pulled is:           10/28/2008 1:59:37 PM As a result the date skips the formatting and does not work, so how can I code this so the date/time will be the same whether its local or on a server, and I have adjusted the regional settings to match - and same issue...

Date entered...add time value to make date/time field
Windows XP Professional InfoMaker v 9.0.2 Build 7509 Our database contains a date/time stamp for when a specific activity happens to each shipment. I would like the users to be able to simply enter a date for a specific work day. I need to get a list of shipments where the time of one activity occurred on the entered date prior to 9:20. How can I create a computed field that will basically concatenate/amend the entered date with 9:20 that will later be used for criteria in returning rows? Thanks in advance for any help you can provide! Rita Palazzi Senior Engineer /...

just Time or date portion of date/time field: SOMEBODY PLS
Good Day, From a DateTime data column how do I get just a Time portin or just a date portion of data to be displayed. i.e from 11/6/2003 10:03:20 AM I need to display date and time seperately in my data display page. Thanks Regards, When you pull in a SQL datetime column value into your .NET code, it is usually cast to a .NET DateTime type... something like this: System.DateTime TheDateAndTime = (System.DateTime)someDataReader["MySQLDateColumn"] Then you can use a variety of .NET methods included in the DateTime class to convert to a strin...

SQL Server 2005 and conversion of date-time between time-zones
Hi. I am using SQL Server 2005 and have some SQL Jobs which run as scheduled. There is a date-time field in one of my tables which take time-zone specific values. Now I need either of the following: Convert that date-time to equivalent GMT or UTC date-time (with DST awareness). GETUTCDATE() converts local date-time [GETDATE()] to its GMT equivalent, but I have the requirement to change a particular date-time value to GMT.   Convert one date-time value from one time-zone to another time-zone date-time value. Any h...

Dates, Dates, Dates!
Hello all... I am in the process of building an appointment system, and I am trying to see if I can get some pointers on which way to go on this. The first version of this appointment system was very lo-tech, and it stored all of the possible dates/times in the database. Once a user booked an appointment, their information was logged to that date/time, and then that date/time would no longer show in the list of possible openings. This was great for a temporary fix, but with having to pre-populate all of the dates/times, the system would eventually have to be updated to continue on pa...

DATE field to DATE/TIME
Hello, If the field is defined as a DATE and you do: select datefield+1 from mytable Does the ODBC API (actually ASA 9.02 backend) return a field that is DATETIME or a DATE field? It is messing up my compiled application and seems to be coming back as DATETIME. Thank you. -Robert You are correct, the value is being returned as a TIMESTAMP. You can verify this through using the EXPRTYPE() builtin function, as in select exprtype('select datefield+1 from mytable', 1) from dummy which will return TIMESTAMP. Exprtype is documented in the help. You alm...

Convert Date/Time to Date
Hi I'm using .NET 2.0 framework with a Postgres DB. I'm getting date values from the table 'creationdate' and I need to compare it with other date value (given by me). The thing is that tha date returned from the DB comes like this '27-03-2006 0:00:00' and the date value that I use to campare comes like this '27-03-2006'. I want to know how to convert the returned date value from the DB to date only...?! I tried using the following: SELECT CONVERT(char(10),creationdate,101) AS date FROM calendar.events WHERE date = "myDate"; but it gives me an error: syntax error at or near "," at c...

Removing Time from date time
We would like to form a recordset that would have the datetime column be just the date. We have students visiting our web several times a day and each of these are counted as distinct dates. We would like just the total number of days that they used the web not the total number of times they accessed the web. Thanks Jim You can use date function on datetime column, or use cast. eg: select datetime_col, date(datetime_col), cast(datetime_col as date) from some_table Hope this helps, Goran jmwarren wrote in message <39A66A36.8B355AA6@pilot.msu.edu>... >We would li...

Date raw date time
I have a value in a string array that is {3/15/1976} When I do a tostring with a short date it changes that to 15/03/1976 Is there a way I can get just the raw text out of the string? Without it giving it to me as a date? Thanks Hi latrotter2, If you have a DateTime object and want to the string value to have a certain format, you must pass the format to the .ToString() Methos. Example: [Visual Basic] Dim tempDateString As String = DateTime.Today.ToString("M/d/yyyy") Response.Write(tempDateString) [C#] string tempDateString = DateTime.Today.ToStr...

Web resources about - date/time or date and time - asp.net.sql-datasource

Raj Date - Wikipedia, the free encyclopedia
... industry in 2009 to start the Cambridge Winter Center, a nonprofit think tank devoted to promoting the regulation of financial firms. Date joined ...

Maps Minutes Hack #3: save time with up-to-date holiday business hours
... if you’ll make it before the store closes to grab that last minute gift–Google Maps has you covered. This year we launched a few updates to ...

Ben Folds & yMusic announce 2016 tour dates
... tour this year ahead of their collaborative album, So There. Now that it's out, they've got plans for a much bigger tour in 2016. Dates include ...

‘Lion Guard’ TV Series Gets Disney Channel Launch Date
Disney has set a premiere date for The Lion Guard , its new animated series that serves as a continuation of the Lion King franchise. The show ...

The Division adds alpha, delays beta, keeps release date
The pre-release plans for Tom Clancy's The Division got a minor shake-up today. The upcoming survival shooter no longer has a beta before the ...

Gwen Stefani Rocks Blake Shelton's Hat After PDA-Filled Date Night
Gwen Stefani Rocks Blake Shelton's Hat After PDA-Filled Date Night

Did 'Good Dinosaur' Date Change Hurt Its Box Office?
'Good Dinosaur' image courtesy of Disney I took some notice of The Good Dinosaur and its "small for Pixar" $55 million Wednesday-to-Sunday and ...

Flooding Forces Zoo Miami to Close; No Reopening Date Set
Days of heavy rainfall, flooding force Zoo Miami to close; no reopening date scheduled

Video Perfectly Shows What Happens When A Dog Owner Goes On A First Date
... the dog as well. A new installment of BuzzFeed's "Puppyhood " video series follows owner Max through his preparation and eventual first date ...

‘Winds Of Winter’ Release Date: George R.R. Martin Doesn’t See Anyone Else Finishing ‘Game Of Thrones’ ...
While fans are still eager for a Winds of Winter release date confirmation, author George R.R. Martin remains hush about whether he’s already ...

Resources last updated: 12/10/2015 10:29:26 AM