By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,730 Members | 1,500 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,730 IT Pros & Developers. It's quick & easy.

Getting Time From Date Stamp

P: 2
haii i need to get the time from the date time stamp which is stored in the database(SQL)..............

i am getting the date time stamp like this..01-Jan-2000 08:00:00

i want it like..08:00:00..

can anyone help me please...
Apr 1 '08 #1
Share this Question
Share on Google+
3 Replies


Frinavale
Expert Mod 5K+
P: 9,731
haii i need to get the time from the date time stamp which is stored in the database(SQL)..............

i am getting the date time stamp like this..01-Jan-2000 08:00:00

i want it like..08:00:00..

can anyone help me please...
Please check out the Date class for a list of all of the methods that can be used to retrieve the Time value from a Date object. You will be most interested in the Hour, Minute, Second properties of the date class.

If your time stamp is not in the format of a date, you are going to have to research how to parse Strings to retrieve the value that you are looking for.

-Frinny
Apr 1 '08 #2

Plater
Expert 5K+
P: 7,872
Ahem, frinny i think too quickly copy/pasted her link.
You're looking for the DateTime object.
Particularily if you have that string from the database you could do:
DateTime myDT=DateTime.Parse(mystring);

And then myDT would be an instance of the DateTime object equal to the value from the database. You can use the properties of the DateTime object to get just the time values.
Apr 1 '08 #3

Frinavale
Expert Mod 5K+
P: 9,731
Ahem, frinny i think too quickly copy/pasted her link.
>>blush<<
You're looking for the DateTime object.
Plater's right....don't know why I went for the Date object anyways, I haven't used it in a long time.
Apr 1 '08 #4

Post your reply

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