Update Only the Time in a date time field

Hi,

i have a table having a datatime field and on a datagrid I need only to display and update the time part. I'm using

select CONVERT(CHAR(8), JobStartTime, 8) AS StartTime from table to get the date. What is  the best way to write the update command . What woul dbe the best approch.

 

Regards,

Vijay

0
vije
11/30/2007 12:56:10 AM
asp.net.object-datasource 16182 articles. 0 followers. Follow

2 Replies
860 Views

Similar Articles

[PageSpeed] 36

 1. Instate of doing formatting in the SQL, Try to do that is the DataGrid with FormatString.

 2. To Update the Database , you can do that in two ways.

    a. Either go for Store Procudure. Send the TIME you want to set for record. Your SP should some how chage the Time Part of the DateTime field and set that in record.

    b. Send Complete DateTime Field. Here You should have 'Date' For each Record with you. Create DataTime Value in the ASP.NET codebehind and then send that to Database.
 

 

 


Somnath Mali
.NET Developer , Pune INDIA.






Please Mark As Answer If my reply helped you.

0
somnathmali
11/30/2007 6:06:18 AM

Hi somnathmali,

Thanks for the hint fella. In the gridview under column you have a property to impose the formatting at edit mode. When u set that to true .NET handles the date part and time part as you have given in the formatting string.  So you don't need to worry about the stored procedures or do it in the DAL or BLL. Any way your hint helped me finding the solution.

Thanks again.

Vijay

0
vije
11/30/2007 5:53:03 PM
Reply:

Similar Artilces:

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...

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 ta...

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...

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 /...

Updated Date/Time all Time Zones
Hi,I am working on a Web ASP.NET APPLICATION, which has different sub domains for all the different Countries, I need to show the Current Date/Time based on DayLight Saving as well but I am unable to find a perfect solution for this, I am not looking for a Paid WebService as the Site might not show the Date/Time if the Vendor stops that WebService,it is one crucial requirement and I am sure there should be a way in asp.net 2.0 to figure this out.......thanks    A fundamental rule in technology says whatever can be done will be done See this: http://www.timeanddate.com/time/dst200...

hide time in date/time field
hi. i have code : objConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\database\tfasim.mdb;")   if rblLTorGT.SelectedValue = "Id" then      strSQLQuery = "SELECT Date_T as  [date] ,name FROM table " & _     ORDER BY " & ddlSortBy.SelectedItem.Value.ToString() & ddlSortOrder.SelectedItem.Value.ToString()   objCommand = New OleDbCommand(strSQLQuery, objConnection)   objConnection.Open()    objData...

Update field field value at specified date and time....
I am doing one project in that...... after login user set one date and time...........it will store in one sql table.......... now user logout from the page also website ..... but now i want to update one field value to 1 but on specified date and time which was entered by user so many days ago..... Please help....... i know the code to update sql table but where to write that code(fire on that particular date and time) and  that i dont know..........Mayursinh B Rana9898010015Marking a Reply as 'Answered', not only GAIN us some POINTS, but it also HELP others ...

Date / Time Field
PB 7.0.3 I have an application that records patient encounters, treatments and referrals for an Emergency Department within a hospital. Each encounter records time to nurse and time to physician - these fields are of datetime format. This application is for statistical purposes only and therefore is not real time (unit clerks key in the necessary data throughout the day). Here is a senerio... Patient A enters the ED and the date / time of encounter is recorded. The date and time that the triage nurse first assesses the patient is recorded (time to nurse) The date and time that th...

Date Time field return just time
 Hi, I have a data/time field in access which is queried using a datasource linked to a check box list, the field contains only hh:mm but is returning dd/mm/yyyy hh:mm, does anyone know how to just return hh:mm? Thanks  Hi, It will return complete date and timestamp so if you want the same to be displayed in hh:mm format then while qerying you will need to format the feild if you want it in hh:mm.  ThanksAshishhttp://itsmeashish.blogspot.com...

Seperate Date and Time Merge; done at SQL Update or C# .NET then Update
I do realize that his could be posted in a few spots but I think the answer is in the SQL. I have a ASP.NET page, with a SqlDataSource, Text Box and Calendar Controls. I have the textbox and calendar controls eval'ed to the same sql data source DateTime Field. The text box is formatted eval to small time and the calendars eval has no formatting. ex: <asp:TextBox ID="START_TIME" Text='<%# Eval("EVENT_START","{0:t}") %>' runat=server Width=200></asp:TextBox> I want to merge the two controls; one has the date the other has the time when I update the pages data to the SqlDa...

remove time part from a date/time field value
How does one remove or avoid the time part from a date/time field value. For example store 12/12/2006 instead of 12/12/2006 12:00:00 Am --------------------------------------------------No Project Too Eazy.-------------------------------------------------- You can use one of the appropriate Standard DateTime Format Strings such as d or D.Darrell Norton, MVPDarrell Norton's BlogPlease mark this post as answered if it helped you! You should be able to use DateTime dt = DateTime.Now dt.ToString("d")  //this will format as short date time FYI: If you want to do it at the query ...

times out all the time!!!
Name: Optical Excellence Email: specsatopticalexcellencedotca Product: Thunderbird Summary: times out all the time!!! Comments: I can not access either the web email site downloaded mail nor the Thunderbird email downloaded email because I get a time out all the time!! Not a way to run an email site, especially as this is for our business! Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6 ...

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...

time-time
Hi There, Delphi 2010 with PostGresSQL 9.3 database. I did try := Time(), the way it worked with Paradox and many more I tried. E2250 no overload version of "TimeToStr" that can be called with this argument. Can somebody guide me here, thanks in advance. {delphi code} dm.tArrivedwaiting.value := timetostr() - dm.tArrivedtime.value ; {code} Fields are StringFields or time with time zone(tried without??) ////// CREATE TABLE "ARRIVED" ( dummy serial NOT NULL, userno smallint, "time" time with time zone, patientno integer, ...

Web resources about - Update Only the Time in a date time field - asp.net.object-datasource

Windows Update - Wikipedia, the free encyclopedia
Windows Update is a service provided by Microsoft that provides updates for the Microsoft Windows operating system and its installed components, ...

Gizmodo.com Updates
Nobody should have to use a pay phone , natural disaster or no natural disaster. So if your gadgets are out of juice after Sandy, here’s a tiny ...

Lifehacker.com Updates
By Whitson Gordon Ever run into a situation where you have multiple wireless networks available, but one is clearly better than the other? WiFi ...

Facebook To Update Mobile Apps Every 4 To 8 Weeks
On the same day that Facebook released a bunch of mobile updates for Apple and Android devices , the social network also announced that it will ...

Madden NFL Mobile Receives Road to the Playoffs Update
Electronic Arts has released a new update for Madden NFL Mobile , as well as an infographic detailing stats about the game. The update features ...

Nest announces new software with major updates
... integration with multiple devices such as Amazon Echo and Harmony remotes (at least some models). Now the device maker is rolling out an update ...

Lenovo patches serious flaws in PC system update tool
For the third time in less than six months security issues have forced Lenovo to update one of the tools preloaded on its PCs. Last week, the ...

SportsNet Central Update: Celtics & Bruins both escape with wins
... Login Search form Search 51° Main menu Home Celtics Patriots Red Sox Bruins Revolution More WRITERS Watch Shop NECN SportsNet Central Update: ...

Instagram update lets you seamlessly manage multiple accounts
Instagram is bringing a great new update to Android and iOS that allows users to seamlessly manage multiple accounts. The change means you’ll ...

Divekick's final update brings in a new free character
After over two years of ongoing support, fighting game parody and community in-joke Divekick has received its final update. Dubbed Divekick ...

Resources last updated: 11/27/2015 8:19:28 PM