Solved

SQL Server Problem when Converting DateTime from Float

Posted on 2006-06-14
5
614 Views
Last Modified: 2008-01-09
Dear Sir.

I have one system called Secure Perfect from GE (General Electronics) this system used for Time & Attendence, this system has its database in which this store the employee punch record, when i saw the table it show me both the Microdate and Systemdate fields as float there are some values of Date 14/06/2006

38882.375556
38882.396042
38882.397037
38882.407303

these are the punches record datetime.

when i try to convert these values from my query into user friendly date and time it gives me values with wrong date i.e.
" 2006-06-16" and punch is recorded on " 2006-06-14" and even on the evenmonitor of Secureperfect where i can watch the live punches monitoring it shows me correct date but when i want to generate report base on the data inside database i am facing a problem.

If you try to execute these command on above mention data you will find the date same like i mention show.
commands i try to execute are.

select cast(38882.375556 as datetime)

 Or

select convert(Datetime,38882.375556,101)

these both give you this data" 2006-06-16 XX:XX:XX.XX "
but these punches was record on 2006-06-14



looking forward for your reply.

Kind regards,

Zeeshan
0
Comment
Question by:altuwairqi2
[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
  • 2
5 Comments
 
LVL 28

Expert Comment

by:imran_fast
ID: 16900820
hi Zeeshan,
the result what you are getting is correnct ie 2006-06-16
i think there might be something wrong in your punching system here how this conversion works

38882.407303

the value 38882 is the no. of days after 1900-01-01 and 407303 is the time
so if you manuall want to convert this to date then

select dateadd(day,38882,'1900-01-01')
which will give you 16 june 2006

so please verify your punching system date and server dates.
0
 

Author Comment

by:altuwairqi2
ID: 16901056
Dear Sir.

i check the database Collation it is Arabic_CI_AS now is there any way i can convert this date back to Georgian?

thanks and regards,
0
 
LVL 28

Accepted Solution

by:
imran_fast earned 500 total points
ID: 16926451
If you are 100% sure about this then use this subtract two days from that date.

select dateadd(day,-2,convert(Datetime,38882.375556,101))

0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

726 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