Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 just show time in SQL

Author  Topic 

jarv
Posting Yak Master

131 Posts

Posted - 2007-08-02 : 04:19:58
in my MSSQL database my eventTime field is reading: 01/01/1900 12:45:00

how do i remove the date from the start?

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-08-02 : 04:24:32
SELECT CONVERT(CHAR(8), eventTime, 108)
FROM Table1



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

jarv
Posting Yak Master

131 Posts

Posted - 2007-08-02 : 06:20:43
where do i oput that in
  Set Rs1 = objconn.execute ("SET DATEFORMAT dmy SELECT * FROM members INNER JOIN tEvents ON members.UserID = tEvents.UserID INNER JOIN pubs ON tEvents.PubID = pubs.PubID ORDER BY eventTime")
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-08-02 : 06:27:57
See also:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=55210&SearchTerms=Time+Only+Function,Date+formatting,Format+Date

Kristen
Go to Top of Page

KenW
Constraint Violating Yak Guru

391 Posts

Posted - 2007-08-03 : 15:08:00
Obviously, you can't use SELECT * (and shouldn't, anyway) because you need to change the format of the data, unless you want to change the format in your application.

In your SQL, change the SELECT * to


SELECT <aField>, <anotherField>, CONVERT(CHAR(8), eventtime, 108) FROM members INNER JOIN ... /* rest of your query here */

Go to Top of Page

jarv
Posting Yak Master

131 Posts

Posted - 2007-08-05 : 15:25:09
can't user SELECT *? can't i set it up in the MSSQL db to just show teh date?
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-08-05 : 15:52:37
no you can't. send the whole datetime to your asp and format it there to show only time.


_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page
   

- Advertisement -