C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




hi frnds please help me its urgent


Posted Date: 05 Sep 2008      Total Responses: 6

Posted By: ramya       Member Level: Gold     Points: 1





i have a date field 2008-08-29 17:52:51.937 in this format i want to take the time part alone tat too i should get in this format 5.52.51pm in this format...how to do this using query(sql server 2005)





Responses

Author: Barani     05 Sep 2008Member Level: SilverRating:     Points: 1

search for help by giving convert statement and i am sure u will get solution.serch in mssql2005 help


Author: ANIL PANDEY    05 Sep 2008Member Level: DiamondRating:     Points: 3

hi,


store the date value in a string and SPLIT the string in the like

String strDate = "2008-08-29 17:52:51.937 ";

string[] stDate = strDate.Split(" ");

stDate[0] will give Date n

stDate[1] will give u only the time part


Hope this will work for u ..

Regards,
Anil

Thanks & Regards
Anil Kumar Pandey



Author: avtar    05 Sep 2008Member Level: GoldRating:     Points: 3

Try :) this :)

declare @d datetime
set @d = '2008-08-29 17:52:51.937'
select @d

select cast(datepart(hh,@d) as varchar(2)) + ':' + cast(datepart(mm,@d) as varchar(2)) + ':' + cast(datepart(s,@d) as varchar(2))


SELECT RIGHT(CONVERT(VARCHAR(19), CONVERT(SMALLDATETIME, @d), 0),7);



Author: Lakhan Pal    05 Sep 2008Member Level: GoldRating:     Points: 1

SELECT CONVERT(VARCHAR(20),GETDATE(),108 )

Try Out This :)



Author: suresh kumar    06 Sep 2008Member Level: BronzeRating:     Points: 2

hi...for this u can use this....
tbx_TimeReceipt.Text = Date.Now.Hour.ToString + ":" + Date.Now.Minute.ToString + ":" + Date.Now.Second.ToString




Author: Suba Ganesh    06 Sep 2008Member Level: SilverRating:     Points: 2


declare @d datetime
set @d = '2008-08-29 17:52:51.937'
SELECT RIGHT(CONVERT(VARCHAR(19), CONVERT(SMALLDATETIME, @d), 0),7);



Post Reply
You must Sign In to post a response.
Next : sql query
Previous : Table Data
Return to Discussion Forum
Post New Message
Category: SQL Server

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use