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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Time only from TIMEDATE

Author  Topic 

simplymidori
Starting Member

9 Posts

Posted - 2008-05-22 : 10:02:16
I have browsed around for answers and I thought I was close find the solution.

I have a TIMEDATE (05/26/2008 19:45:00)field and I'm looking to store only the time value in military time with seconds. (00:00:00)

I tried using the following format style and returned the date still
CONVERT (VARCHAR(10), ULTIMEDATE, 108)

Any suggestions? Thanks in advance

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-05-22 : 10:08:26
This works just fine:

select CONVERT (VARCHAR(10), getdate(), 108)


Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

simplymidori
Starting Member

9 Posts

Posted - 2008-05-22 : 10:16:23
I tried again using and it returned date.

CONVERT (VARCHAR(10),ULTIMEDATE, 108)

I'm not wanting system time.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-05-22 : 10:40:28
The "date" you are referring to, is that "January 1st, 1900"?



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

simplymidori
Starting Member

9 Posts

Posted - 2008-05-22 : 10:42:16
I get this 05/26/2008
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-05-22 : 10:48:52
Oh, so TIMEDATE is not a typo? You actually have a user defined datatype named TIMEDATE (which in turn is varchar)?

CONVERT(CHAR(8), CAST(ulTimeDate AS DATETIME), 108)

EDIT: explanation

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

simplymidori
Starting Member

9 Posts

Posted - 2008-05-22 : 10:49:57
Gracias! I owe you lunch!
Go to Top of Page
   

- Advertisement -