Re: Migrate DATETIME field in DTS via excel in SQL Server 2000 -
03-20-2008
, 10:01 AM
I found that the time part isn't really truncated off during a DTS
migration when using an Excel spreadsheet as a transport vehicle. By
default, the date columns of the spreadsheet DTS creates are set to
display the date part of the datetime value. By selecting the date
column, and right clicking and selecting format cells, you can select
a time format that will display the datetime with both date and time
parts. If you save the spreadsheet in excel after this, you will also
be able to see the date/time values in Microsoft's Excel viewer.
If you are finding that DTS seems to migrate the dates okay, but not
the times, then the problem you may be experiencing is that the dates
are saved as GMT times, and you need to use timezones to read/write
the exported date data. Read about the .NET TimeZone and TimeSpan
functions in Visual Studio .NET's help file. These functions allow
your code to determine the timezone used on the computer the export
data arrived to, and expose a getUTCOffset method which returns an
offset which you can add to the date to adjust it for your timezone. |