dbTalk Databases Forums  

Date Time String Transformation

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


Discuss Date Time String Transformation in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Joel Gacosta
 
Posts: n/a

Default Date Time String Transformation - 07-13-2003 , 02:41 AM






Hi All!

Is there a way in Date Time String Transformation Properties to convert the
time format to 24H? I have tried all the date format but i don't see any 24H
format. Please help.

Thanks



Reply With Quote
  #2  
Old   
John Bell
 
Posts: n/a

Default Re: Date Time String Transformation - 07-13-2003 , 04:12 AM






Hi

If you are storing the information in a datetime datatype then you can
choose the display format when retrieving the data using the convert
command. If this is a character data type then you would have to specify the
format of the input such as yyyy-mm-dd hh:sstt and the format of the output
as yyyy-mm-dd HH:ss. (as HH is 24 hour format). Although there are some
formats already available in the dropdown list, you can always type in your
own.

John


"Joel Gacosta" <joel (AT) bluemediacomm (DOT) com> wrote

Quote:
Hi All!

Is there a way in Date Time String Transformation Properties to convert
the
time format to 24H? I have tried all the date format but i don't see any
24H
format. Please help.

Thanks





Reply With Quote
  #3  
Old   
Joel Gacosta
 
Posts: n/a

Default Re: Date Time String Transformation - 07-13-2003 , 04:47 AM



Great! I must format the input source into 24H first before i can have the
output in 24H else i would stuck in 12H even if I specify the output format
as HH:mm:ss. Thanx!

joel


"John Bell" <jbellnewsposts (AT) hotmail (DOT) com> wrote

Quote:
Hi

If you are storing the information in a datetime datatype then you can
choose the display format when retrieving the data using the convert
command. If this is a character data type then you would have to specify
the
format of the input such as yyyy-mm-dd hh:sstt and the format of the
output
as yyyy-mm-dd HH:ss. (as HH is 24 hour format). Although there are some
formats already available in the dropdown list, you can always type in
your
own.

John


"Joel Gacosta" <joel (AT) bluemediacomm (DOT) com> wrote in message
news:eDCuiIRSDHA.2316 (AT) tk2msftngp13 (DOT) phx.gbl...
Hi All!

Is there a way in Date Time String Transformation Properties to convert
the
time format to 24H? I have tried all the date format but i don't see any
24H
format. Please help.

Thanks







Reply With Quote
  #4  
Old   
Joel Gacosta
 
Posts: n/a

Default Re: Date Time String Transformation - 07-13-2003 , 06:43 AM



Sorry i forgot to tell you that i'm converting from a character data type
and not a datetime data type.

ciao

"Andrew J. Kelly" <sqlmvpnooospam (AT) shadhawk (DOT) com> wrote

Quote:
I don't think you fully understood what John was saying. SQL Server
doesn't
store the date and time information as you visually see it. It always
knows
what is AM and what is PM when it is stored. You don't need to convert it
as 24 hour format before inputting the data since sql server also knows
about AM and PM in the input string. You must have that information there
otherwise how would you know which ones to add 12 hours to in order to
convert to military time?

--

Andrew J. Kelly
SQL Server MVP


"Joel Gacosta" <joel (AT) bluemediacomm (DOT) com> wrote in message
news:ecAcOPSSDHA.3144 (AT) tk2msftngp13 (DOT) phx.gbl...
Great! I must format the input source into 24H first before i can have
the
output in 24H else i would stuck in 12H even if I specify the output
format
as HH:mm:ss. Thanx!

joel


"John Bell" <jbellnewsposts (AT) hotmail (DOT) com> wrote in message
news:3f11226d$0$18761$afc38c87 (AT) news (DOT) easynet.co.uk...
Hi

If you are storing the information in a datetime datatype then you can
choose the display format when retrieving the data using the convert
command. If this is a character data type then you would have to
specify
the
format of the input such as yyyy-mm-dd hh:sstt and the format of the
output
as yyyy-mm-dd HH:ss. (as HH is 24 hour format). Although there are
some
formats already available in the dropdown list, you can always type in
your
own.

John


"Joel Gacosta" <joel (AT) bluemediacomm (DOT) com> wrote in message
news:eDCuiIRSDHA.2316 (AT) tk2msftngp13 (DOT) phx.gbl...
Hi All!

Is there a way in Date Time String Transformation Properties to
convert
the
time format to 24H? I have tried all the date format but i don't see
any
24H
format. Please help.

Thanks











Reply With Quote
  #5  
Old   
John Bell
 
Posts: n/a

Default Re: Date Time String Transformation - 07-13-2003 , 07:27 AM



Hi

As you are using a datetime data type for the column, you may not need any
conversion for the time portion as SQLServer will understand it. Depending
on the input format, you may have problems with the month and day being
imported incorrectly, in which case a format will be needed for that.

When you want to select the data from the table you can convert it into a
formatted string using the convert function
see
http://msdn.microsoft.com/library/de...asp?frame=true

Such as

SELECT convert(varchar,datefld,108), convert(varchar,datefld,9) FROM MyTable

If you only want part of the string returned and convert does not give you
the exact format use the string functions RIGHT, LEFT or SUBSTRING
http://msdn.microsoft.com/library/de...asp?frame=true

John

"Joel Gacosta" <joel (AT) bluemediacomm (DOT) com> wrote

Quote:
Sorry i forgot to tell you that i'm converting from a character data type
and not a datetime data type.

ciao

"Andrew J. Kelly" <sqlmvpnooospam (AT) shadhawk (DOT) com> wrote in message
news:OL7HlFTSDHA.940 (AT) TK2MSFTNGP11 (DOT) phx.gbl...
I don't think you fully understood what John was saying. SQL Server
doesn't
store the date and time information as you visually see it. It always
knows
what is AM and what is PM when it is stored. You don't need to convert
it
as 24 hour format before inputting the data since sql server also knows
about AM and PM in the input string. You must have that information
there
otherwise how would you know which ones to add 12 hours to in order to
convert to military time?

--

Andrew J. Kelly
SQL Server MVP


"Joel Gacosta" <joel (AT) bluemediacomm (DOT) com> wrote in message
news:ecAcOPSSDHA.3144 (AT) tk2msftngp13 (DOT) phx.gbl...
Great! I must format the input source into 24H first before i can have
the
output in 24H else i would stuck in 12H even if I specify the output
format
as HH:mm:ss. Thanx!

joel


"John Bell" <jbellnewsposts (AT) hotmail (DOT) com> wrote in message
news:3f11226d$0$18761$afc38c87 (AT) news (DOT) easynet.co.uk...
Hi

If you are storing the information in a datetime datatype then you
can
choose the display format when retrieving the data using the convert
command. If this is a character data type then you would have to
specify
the
format of the input such as yyyy-mm-dd hh:sstt and the format of the
output
as yyyy-mm-dd HH:ss. (as HH is 24 hour format). Although there are
some
formats already available in the dropdown list, you can always type
in
your
own.

John


"Joel Gacosta" <joel (AT) bluemediacomm (DOT) com> wrote in message
news:eDCuiIRSDHA.2316 (AT) tk2msftngp13 (DOT) phx.gbl...
Hi All!

Is there a way in Date Time String Transformation Properties to
convert
the
time format to 24H? I have tried all the date format but i don't
see
any
24H
format. Please help.

Thanks













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.