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 2005 Forums
 SQL Server Administration (2005)
 get Trouble with datetime type

Author  Topic 

hungleon88
Starting Member

16 Posts

Posted - 2008-09-17 : 14:52:01
Hi everybody, I have a trouble with datetime type.
when i insert record from java application, the column Date always have a record like this : Sep 18 2008 12:00 AM
It's always 12:00 AM.It's cannot get the current time(Month, Day, year are right).
Can you guys hint me solve this??
Thanks!

mcrowley
Aged Yak Warrior

771 Posts

Posted - 2008-09-17 : 14:54:28
Try inserting the function getdate().
Go to Top of Page

hungleon88
Starting Member

16 Posts

Posted - 2008-09-17 : 15:03:42
but getDate() cannot get the time.It only get Month,Day and year...
Go to Top of Page

mcrowley
Aged Yak Warrior

771 Posts

Posted - 2008-09-17 : 15:45:27
I see you have already tried this?
select getdate()
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-09-17 : 16:06:31
quote:
Originally posted by hungleon88

but getDate() cannot get the time.It only get Month,Day and year...



GETDATE() provides the time. If you aren't seeing the time, then you've got an application bug.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

lepeniotis
Yak Posting Veteran

75 Posts

Posted - 2008-09-18 : 04:15:22
Hey try this

cast(getdate() as VARCHAR(20))

It works for me!!

Let me know if that helped.

Regards

MSc Advanced Computing Science
MSc Database Professional
Sheffield Hallam University
MCP (70-229, 70-228)
Industrial IT Engineer
Go to Top of Page
   

- Advertisement -