Home All Groups Group Topic Archive Search About

Convert date without seconds - dd mon yyyy hh:mi(24h)

Author
25 Aug 2006 6:05 PM
Totto
Hi,
How is it possible to convert date without seconds ?
dd mon yyyy hh:mi(24h)
Cant find that convert() has an option for this.
Thanks Totto

Author
25 Aug 2006 6:15 PM
Andrew J. Kelly
select CONVERT(CHAR(16),GETDATE(),120)

--
Andrew J. Kelly SQL MVP

Show quote
"Totto" <tor.aadne***@losmail.no> wrote in message
news:%23PLzUEHyGHA.4204@TK2MSFTNGP04.phx.gbl...
> Hi,
> How is it possible to convert date without seconds ?
> dd mon yyyy hh:mi(24h)
> Cant find that convert() has an option for this.
> Thanks Totto
>
>
Author
25 Aug 2006 6:19 PM
Jeffrey Williams
Totto wrote:
> Hi,
> How is it possible to convert date without seconds ?
> dd mon yyyy hh:mi(24h)
> Cant find that convert() has an option for this.
> Thanks Totto
>
>

CONVERT(char(11), getdate(), 113)
Author
25 Aug 2006 6:34 PM
Aaron Bertrand [SQL Server MVP]
Wow this doesn't have hours or minutes either... I think you meant:

SELECT CONVERT(CHAR(17), CURRENT_TIMESTAMP, 113);


Show quote
"Jeffrey Williams" <jeff.willi***@sharp.com> wrote in message
news:uBb$LMHyGHA.2300@TK2MSFTNGP05.phx.gbl...
> Totto wrote:
>> Hi,
>> How is it possible to convert date without seconds ?
>> dd mon yyyy hh:mi(24h)
>> Cant find that convert() has an option for this.
>> Thanks Totto
>>
>>
>
> CONVERT(char(11), getdate(), 113)
Author
25 Aug 2006 6:35 PM
Jeffrey Williams
Jeffrey Williams wrote:
> Totto wrote:
>> Hi,
>> How is it possible to convert date without seconds ?
>> dd mon yyyy hh:mi(24h)
>> Cant find that convert() has an option for this.
>> Thanks Totto
>>
>>
>
> CONVERT(char(11), getdate(), 113)

sorry - misread and excluded the time portion.  Just increase the number
of characters you need in your output.  And, change the format (113) to
the specific format you want.
Author
25 Aug 2006 6:31 PM
Alan Brewer [MSFT]
The simplest syntax is to just convert into a datatype that is only large
enough to hold up to the minutes:

SELECT CONVERT(NCHAR(17),GETDATE(),113);

If you were using larger strings, such as having a NCHAR(23) variable with
the string already in it, you could also use either SUBSTRING or LEFT to
truncate the seconds.

--
Alan Brewer [MSFT]
Content Architect, SQL Server Documentation Team

Download the latest Books Online update:
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx

This posting is provided "AS IS" with no warranties, and confers no rights.
Author
25 Aug 2006 8:12 PM
Totto
Thanks all

Totto

Show quote
"Totto" <tor.aadne***@losmail.no> wrote in message
news:%23PLzUEHyGHA.4204@TK2MSFTNGP04.phx.gbl...

AddThis Social Bookmark Button