Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

GetDate Seconds

Posted on 2006-10-24
3
Medium Priority
?
2,403 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 2000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.

636 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