Re: CONVERT help
From: jobi (jobi_at_reply2.group)
Date: 11/02/04
- Previous message: Aiden Fung: "Re: Query on a non indexed column with SQL Server 2000..."
- In reply to: Ron: "CONVERT help"
- Next in thread: Ron: "Re: CONVERT help"
- Reply: Ron: "Re: CONVERT help"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 2 Nov 2004 08:58:38 +0100
try
SELECT
CONVERT(varchar, getdate(), 101) + '-'
+ CONVERT(varchar, getdate(), 101) + ', '
+ substring(CONVERT(varchar, getdate(), 100),13,7) + '-'
+ substring(CONVERT(varchar, getdate(), 100),13,7)
AS 'secinfo'
jobi
"Ron" <junkmail801@hotmail.com> wrote in message
news:e63522b1.0411010911.6480a25c@posting.google.com...
> Hello,
>
> I am having trouble converting to a time format like so: 3:00PM. I
> keep getting 24 hr time formats. Here is the query:
>
> ---
> SELECT sections.sec_id, classes.class_code,
> CONVERT(varchar, sections.sec_date_start, 101) + '-' +
> CONVERT(varchar, sections.sec_date_end, 101) + ', ' + CONVERT(varchar,
> sections.sec_time_start, 108) + '-' + CONVERT(varchar,
> sections.sec_time_end, 108) AS 'secinfo'
> FROM sections, classes
> WHERE sections.class_code = classes.class_code
> ---
>
> From what I can gather, 108 is supposed to convert time to my desired
> format, but it returns 24h time values instead... What am I missing?
> Thanks in advance for the help.
>
> --Ron
- Previous message: Aiden Fung: "Re: Query on a non indexed column with SQL Server 2000..."
- In reply to: Ron: "CONVERT help"
- Next in thread: Ron: "Re: CONVERT help"
- Reply: Ron: "Re: CONVERT help"
- Messages sorted by: [ date ] [ thread ]