dbTalk Databases Forums  

Re: UTC dates in SQL 2000

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Re: UTC dates in SQL 2000 in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: UTC dates in SQL 2000 - 07-02-2004 , 01:22 AM






There is no built in transform type of UTC --> Datetime so you will have to
roll your own so

This is UTC format YYMMDDHHMMZ

I would parse this in a Active Script transform extracting the relevant
parts and rebuilding it into a suitable string for a datatime field in SQL
Server.

We do this partially here

Formatting Character Data into Datetime fields
(http://www.sqldts.com/default.aspx?249)

--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org
"Andrew Robinson" <Andrew Robinson (AT) discussions (DOT) microsoft.com> wrote in
message news:AFE6DC10-51CA-41D8-A499-610281D865A5 (AT) microsoft (DOT) com...
Quote:
I need to create a DTS package to transfer data from SQL to a text file.
My problem is, all the datetime fields in the db are in UTC format. Is there
is function I can use to convert these to datetime format as part of the
transformation?




Reply With Quote
  #2  
Old   
Andrew Robinson
 
Posts: n/a

Default Re: UTC dates in SQL 2000 - 07-02-2004 , 10:48 AM






This db provides dates, which the developer (CISCO)
identifies as UTC, in the format 99999. Using this, 38169
converts to 7/2/04. I can use the
getutcdate() function to return the datetime for the
current UTC, or I can CONVERT(int, datetime) to convert a
datetime into UTC, but neither will work in an ActiveX
script. Are we talking about the same thing, or is Cisco
using UTC in a different way?


Quote:
-----Original Message-----
There is no built in transform type of UTC --> Datetime
so you will have to
roll your own so

This is UTC format YYMMDDHHMMZ

I would parse this in a Active Script transform
extracting the relevant
parts and rebuilding it into a suitable string for a
datatime field in SQL
Server.

We do this partially here

Formatting Character Data into Datetime fields
(http://www.sqldts.com/default.aspx?249)

--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org
"Andrew Robinson" <Andrew
Robinson (AT) discussions (DOT) microsoft.com> wrote in
message news:AFE6DC10-51CA-41D8-A499-
610281D865A5 (AT) microsoft (DOT) com...
I need to create a DTS package to transfer data from
SQL to a text file.
My problem is, all the datetime fields in the db are in
UTC format. Is there
is function I can use to convert these to datetime
format as part of the
transformation?


.


Reply With Quote
  #3  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: UTC dates in SQL 2000 - 07-04-2004 , 02:33 AM



Then have a look at this

select dateadd(day,-38169, '20040702')

It looks as though what you have is days after midnight on 31/12/1899

VBScript has an equivalent function for this.



--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Andrew Robinson" <chunkydrew33136 (AT) hotmail (DOT) com> wrote

Quote:
This db provides dates, which the developer (CISCO)
identifies as UTC, in the format 99999. Using this, 38169
converts to 7/2/04. I can use the
getutcdate() function to return the datetime for the
current UTC, or I can CONVERT(int, datetime) to convert a
datetime into UTC, but neither will work in an ActiveX
script. Are we talking about the same thing, or is Cisco
using UTC in a different way?


-----Original Message-----
There is no built in transform type of UTC --> Datetime
so you will have to
roll your own so

This is UTC format YYMMDDHHMMZ

I would parse this in a Active Script transform
extracting the relevant
parts and rebuilding it into a suitable string for a
datatime field in SQL
Server.

We do this partially here

Formatting Character Data into Datetime fields
(http://www.sqldts.com/default.aspx?249)

--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org
"Andrew Robinson" <Andrew
Robinson (AT) discussions (DOT) microsoft.com> wrote in
message news:AFE6DC10-51CA-41D8-A499-
610281D865A5 (AT) microsoft (DOT) com...
I need to create a DTS package to transfer data from
SQL to a text file.
My problem is, all the datetime fields in the db are in
UTC format. Is there
is function I can use to convert these to datetime
format as part of the
transformation?


.




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.