Click here to Skip to main content
12,353,607 members (69,200 online)
Rate this:
 
Please Sign up or sign in to vote.
I need to save records with todays date as 18-12-2012 12:00:00 AM.while using getdate function current time is saving,but i need dafult time as 12:00:00 AM
Posted 17-Dec-12 18:32pm
josh-jw15.8K
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

no direct function in SQL 2005
so, use below query
select convert(datetime,convert(varchar(10),getdate(),102))
Happy Coding!
Smile | :)
  Permalink  
Comments
joshi.ihsoj 18-Dec-12 1:30am
   
thnx for reply.also we can go for like these.DATEADD(DAY, DATEDIFF(day, 0, GETDATE()), 0)
Aarti Meswania 18-Dec-12 1:36am
   
Welcome! :)

yes you are right,
it's also a way...
but as i said no direct way or direct function in sql.
we have to process getdate() function of sql for this final output
i have use convert function, you used dateadd right? :)

Glad to help you! :)
Have a nice day! :)
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

refer this site for you assistance

http://www.w3schools.com/sql/func_date_format.asp[^]
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

Select right(CONVERT(VARCHAR, GETDATE(), 100),7)

if wants only date then put left at the place of right in the query
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160621.1 | Last Updated 18 Dec 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100