Sunday, February 19, 2012

Convert int to date

Hi,
i have a string representation like '200509'. I want to convert that to
"Septembre 2005". So i've split the two parts up with the left and right
function (now i've got 09 and 2005). Is there a way to say that the 09-part
must transform automatically to "Septembre". I'd rather not use and endless
iif structure. Setting the textbox to a Date type doesn't seem to work
either.
Thx and kind regards,
KoenYou might be able to do something with the SQL functions DATEPART and
DATENAME, I'll look into it and get back to you.
Koen wrote:
>Hi,
>i have a string representation like '200509'. I want to convert that to
>"Septembre 2005". So i've split the two parts up with the left and right
>function (now i've got 09 and 2005). Is there a way to say that the 09-part
>must transform automatically to "Septembre". I'd rather not use and endless
>iif structure. Setting the textbox to a Date type doesn't seem to work
>either.
>Thx and kind regards,
>Koen
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server-reporting/200509/1|||Alternatively, you could write a function to convert it using a switch case
statement in custom code.
I'll write it for you if you like, I don't have much to do at the moment!
Tabby Cool wrote:
>You might be able to do something with the SQL functions DATEPART and
>DATENAME, I'll look into it and get back to you.
>>Hi,
>[quoted text clipped - 7 lines]
>>Thx and kind regards,
>>Koen
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server-reporting/200509/1|||Do you need all of the month names to be in French?
I'll do them that way and you can always change it later if you want
something else.
Koen wrote:
>Hi,
>i have a string representation like '200509'. I want to convert that to
>"Septembre 2005". So i've split the two parts up with the left and right
>function (now i've got 09 and 2005). Is there a way to say that the 09-part
>must transform automatically to "Septembre". I'd rather not use and endless
>iif structure. Setting the textbox to a Date type doesn't seem to work
>either.
>Thx and kind regards,
>Koen
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server-reporting/200509/1|||Are all of your dates 21st century dates? Or do you have some from last
century?
Tabby Cool wrote:
>Do you need all of the month names to be in French?
>I'll do them that way and you can always change it later if you want
>something else.
>>Hi,
>[quoted text clipped - 7 lines]
>>Thx and kind regards,
>>Koen
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server-reporting/200509/1|||Is the value you are using actually a string or an int?
The title of the thread would imply it's an integer, but you said in your
post that it's a string.
I've nearly finished your function, but I need to know whether it's a string
or an integer.
Tabby Cool wrote:
>Do you need all of the month names to be in French?
>I'll do them that way and you can always change it later if you want
>something else.
>>Hi,
>[quoted text clipped - 7 lines]
>>Thx and kind regards,
>>Koen
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server-reporting/200509/1

No comments:

Post a Comment