declare @d datetimeset @d= '2009-5-22' select convert(int,cast(@d as datetime),120)
select datediff(second,'1970-01-01',@d)