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

converting sql datetime to just time in c#

I am returning a datetime from SQL and need to populate a field with just
the time...

I have tried:

DateTime.Parse(TheTime.Hour.ToString()) + ":" +
DateTime.Parse(TheTime.Minute.ToString();

But that does not return the correct HOUW format.

Any suggestions?

Marty
Nov 17 '05 #1
3 6600

"M.Smith" <ma****@bennyhinn.org> wrote in message
news:up**************@TK2MSFTNGP09.phx.gbl...
I am returning a datetime from SQL and need to populate a field with just
the time...

I have tried:

DateTime.Parse(TheTime.Hour.ToString()) + ":" +
DateTime.Parse(TheTime.Minute.ToString();

But that does not return the correct HOUW format.

Any suggestions?

Marty


Hmm...so you want to put the time into a textbox?

txtTextBox.Text = TheTime.ToString("hh:MM")

I believe it is hh:MM, if not, try HH:MM.

Mythran

Nov 17 '05 #2
I am using C# and that does not work...it compiles with an error :

"No overload for method 'ToString' takes '1' arguments"

I will keep looking - any other suggestions I am open to...


"Mythran" <ki********@hotmail.comREMOVETRAIL> wrote in message
news:eG**************@TK2MSFTNGP09.phx.gbl...

"M.Smith" <ma****@bennyhinn.org> wrote in message
news:up**************@TK2MSFTNGP09.phx.gbl...
I am returning a datetime from SQL and need to populate a field with just
the time...

I have tried:

DateTime.Parse(TheTime.Hour.ToString()) + ":" +
DateTime.Parse(TheTime.Minute.ToString();

But that does not return the correct HOUW format.

Any suggestions?

Marty


Hmm...so you want to put the time into a textbox?

txtTextBox.Text = TheTime.ToString("hh:MM")

I believe it is hh:MM, if not, try HH:MM.

Mythran

Nov 17 '05 #3
drG.GetDateTime(0).ToShortTimeString();

Thanks !!

"M.Smith" <ma****@bennyhinn.org> wrote in message
news:up**************@TK2MSFTNGP09.phx.gbl...
I am returning a datetime from SQL and need to populate a field with just
the time...

I have tried:

DateTime.Parse(TheTime.Hour.ToString()) + ":" +
DateTime.Parse(TheTime.Minute.ToString();

But that does not return the correct HOUW format.

Any suggestions?

Marty

Nov 17 '05 #4

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

Similar topics

3
by: Nikola | last post by:
Hi all, I have a problem converting datetime to integer (and than back to datetime). Depending whether the time is AM or PM, same date is converted to two different integer representations,...
4
by: M. Uppal | last post by:
How do i convert fraction to time in c#. I need to convert 0.25 to time. Excel does this by using Selection.NumberFormat = "h:mm:ss;@" of the Cell Format function. thanks, M. Uppal
2
by: Al | last post by:
Hi Is it a function to convert time to and from military time? Thanks
8
by: Mika M | last post by:
Is there better way to convert integer type date into DateTime type date as doing like code below? Dim intDate As Integer = 20051019 Dim dte As DateTime = New DateTime( _...
3
by: NateM | last post by:
How do I convert any given date into a milliseconds value that represents the number of milliseconds that have passed since January 1, 1970 00:00:00.000 GMT? Is there an easy way to do this like...
14
by: msavazzi | last post by:
Hi, it should be simple, put FILETIME in a Long conver it in date using the DateTime.FromFileTimeUtc The help even says: Converts the specified Windows file time to an equivalent UTC time. ...
1
by: Matt | last post by:
Hi all, So a lot of digging on doing this and still not a fabulous solution: import time # this takes the last_modified_date naive datetime, converts it to a # UTC timetuple, converts that...
18
by: Dirk Hagemann | last post by:
Hello, From a zone-file of a Microsoft Active Directory integrated DNS server I get the date/time of the dynamic update entries in a format, which is as far as I know the hours since january 1st...
11
by: Keith Hughitt | last post by:
Hi, I am having a little trouble figuring out how to convert a python datetime to UTC. I have a UTC date (e.g. 2008-07-11 00:00:00). I would like to create a UTC date so that when I send it to...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...
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.