Solved

GetDate Seconds

Posted on 2006-10-24
3
2,400 Views
Last Modified: 2008-01-09
I am using GetDate() as a default in a table item

Strangely it seems to round the time down to the minute..

ie

2006-10-24 20:53:00
 
How do I get it to accurately state seconds?
0
Comment
Question by:MaximusMeridus
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 9

Accepted Solution

by:
gpompe earned 500 total points
ID: 17799388
Probably the field is smalldatetime. Change to datetime and done.
0
 
LVL 43

Expert Comment

by:Eugene Z
ID: 17799405
use datetime instead of smalldatetime

select cast(getdate() as smalldatetime),getdate()

result:
2006-10-24 17:04:00         2006-10-24 17:04:10.217
0
 
LVL 15

Expert Comment

by:DonKronos
ID: 17799406
If the column is defined as "smalldatetime" then the accuracy will only be to minutes.  You need a data type of "datetime" to get seconds and milliseconds.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question