Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Other Development Tools
 integer to date

Author  Topic 

ychalla
Starting Member

2 Posts

Posted - 2009-12-28 : 06:57:14
how to convert integer value to date format in sql server 2005
1252997717

thanks

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-12-28 : 07:27:06
quote:
Originally posted by ychalla

how to convert integer value to date format in sql server 2005
1252997717

thanks


What is the result you want?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-12-28 : 14:20:29
This is how you do it. The trick is to find the metric and the starting point.
In this example, I have used seconds and January 1st 1960.
SELECT DATEADD(SECOND, 1252997717, '19600101')



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-12-28 : 14:21:07
You can also use UNIX representation of January 1st 1970
SELECT DATEADD(SECOND, 1252997717, '19700101')



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

ychalla
Starting Member

2 Posts

Posted - 2009-12-29 : 05:57:50
hi
(sql server 2005)
in table, there is a column timelastmodified(data type is integer)
if i insert any data in the table the above column will updated automatically with some integer value
for example
1261432975
i am unable to understand in which format this is
i am thinking is this date in the integer form
can you please help me
thanks
Go to Top of Page

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2009-12-29 : 06:45:13
Is this table modified by a trigger or some application?

If you insert or update date in the table through management studio does the timestamp update automatically? if so then the application isn't involved.

If there is a trigger then you should be able to see it in management studio and work out what's happening.

IF the application is doing the work then you'll have to start guessing. As peso pointed out the integer is probably just a count of seconds from some defined date. if you know the datetime of update (when you performed the updatE) and you can find the integer then with the two pieces of information we should be able to work out the method used.




Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page

behrman
Yak Posting Veteran

76 Posts

Posted - 2010-01-04 : 12:45:54
Hi
You could move date, month and year into seperate fields using select statement and the same can be merged in Excel with a concatinate.

RAQ Report: Web-based Excel-like Java reporting tool
Go to Top of Page
   

- Advertisement -