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.
| Author |
Topic |
|
rajasekhar857
Constraint Violating Yak Guru
396 Posts |
Posted - 2010-06-23 : 07:27:48
|
| hi i am having two values where both are converted from date to numeric value in milliseconds.i.e i wan to know date of birth those are 487861200000456325200000the above one are now converted in milliseonds value.from the difference of the above value i want to know the no of years.how can i do that? |
|
|
Lumbago
Norsk Yak Master
3271 Posts |
Posted - 2010-06-23 : 07:45:45
|
Could this be it...? ->DECLARE @date datetime = '1970-01-01 00:00:00'SELECT DATEADD(SECOND, 487861200, @date) - LumbagoMy blog (yes, I have a blog now! just not that much content yet) -> www.thefirstsql.com |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-06-23 : 07:49:33
|
quote: from the difference of the above value i want to know the no of years.how can i do that?
select (487861200000 - 456325200000) / 365.0 / 24.0 / 60.0 / 60.0 / 1000.0 KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
Lumbago
Norsk Yak Master
3271 Posts |
Posted - 2010-06-23 : 08:09:44
|
| HmSELECT DATEDIFF(year, getdate(), dateadd(second, (487861200000 - 456325200000)/1000, getdate()))- LumbagoMy blog (yes, I have a blog now! just not that much content yet) -> www.thefirstsql.com |
 |
|
|
rajasekhar857
Constraint Violating Yak Guru
396 Posts |
Posted - 2010-06-23 : 08:15:01
|
| thanks |
 |
|
|
|
|
|