w3ka dev - share the knowledge .NET
3 ways to get date in SQL without time
Here are 3 ways of getting date-only part of timestamp in SQL Server:
1. DATEADD( DAY, 0 , DATEDIFF(DAY,0, CURRENT_TIMESTAMP) )
2. CONVERT( datetime, FLOOR(CONVERT(float(24), GETDATE())) )
3. CAST( CONVERT(CHAR(8), GETDATE(),112) as DATETIME)
Strip time from javascript date object
Setting up the hours to zero does the trick:
var myDate = new Date(); //current date and time
myDate.setHours(0,0,0,0);
Newer Posts
Older Posts
Home
Subscribe to:
Posts (Atom)