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 |
|
sbmiller
Starting Member
3 Posts |
Posted - 2008-12-04 : 15:13:31
|
| I imported a MySql table from Joomla Fireboard into Sql server 5.0the datetimefield data type is float and the values look like 1207370000 I need to convert that to datetime value in my sql server tablethank |
|
|
revdnrdy
Posting Yak Master
220 Posts |
Posted - 2008-12-04 : 15:20:24
|
| Try this, select convert (datetime,(cast(cast(20050101.0 as int)as varchar)),103)This will show the date only.. time will be all 0's.Here is the output: 2005-01-01 00:00:00.000btw the the 1207370000 value you supplied is not a float.It doesnt look like a valid date either (per my example) |
 |
|
|
sbmiller
Starting Member
3 Posts |
Posted - 2008-12-04 : 15:39:08
|
| Is i possible that it is a time value based on 24 hour clock??? |
 |
|
|
revdnrdy
Posting Yak Master
220 Posts |
Posted - 2008-12-04 : 15:50:42
|
| The value you have is a unix timestamp not a datetime datatype.so try this..SELECT DATEADD(s, 1207370000, '19700101') The Result is:2008-04-05 04:33:20.000hope that helps.. make sure you understand your data type ! |
 |
|
|
sbmiller
Starting Member
3 Posts |
Posted - 2008-12-04 : 16:12:46
|
| That wa the ticket thanks |
 |
|
|
|
|
|