Sunday, February 19, 2012

Date Conversion!

Can anyone suggest how to convert a dd/mm/yyyy format date to a mm/dd/yyyy
formatted date using a user defined function.
This funtion is to be called inside a stored procedure.
I have already written a conversion function that handle mm/dd/yyyy to
dd/mm/yyyy. Not sure how to go the other way.
I used date part for the mm/dd/yyyy coversion, but i assume it only
recocognises mm/dd/yyyy dates at parse time, so feeding it a dd/mm/yyyy date
won't do.
Help Appreciated.
AJDates are not stored in any particular format, so your question is simply hp
w
to format a date for display as mm/dd/yyyy. The convert function will do
this when passed a format specifier of 101.
Select convert(varChar(10), getdate(), 101)
103, by the way, formats any date as dd/mm/yyyy..
Select convert(varChar(10), getdate(), 103)
"AJ" wrote:

> Can anyone suggest how to convert a dd/mm/yyyy format date to a mm/dd/yyyy
> formatted date using a user defined function.
> This funtion is to be called inside a stored procedure.
> I have already written a conversion function that handle mm/dd/yyyy to
> dd/mm/yyyy. Not sure how to go the other way.
> I used date part for the mm/dd/yyyy coversion, but i assume it only
> recocognises mm/dd/yyyy dates at parse time, so feeding it a dd/mm/yyyy da
te
> won't do.
> Help Appreciated.
> AJ
>|||Hi
For more on date conversion & formatting issues, please refer to
http://msdn.microsoft.com/library/d.../>
ez_2h7w.asp
best Regards,
Chandra
http://chanduas.blogspot.com/
---
"CBretana" wrote:
> Dates are not stored in any particular format, so your question is simply
hpw
> to format a date for display as mm/dd/yyyy. The convert function will do
> this when passed a format specifier of 101.
>
> Select convert(varChar(10), getdate(), 101)
> 103, by the way, formats any date as dd/mm/yyyy..
> Select convert(varChar(10), getdate(), 103)
> "AJ" wrote:
>

No comments:

Post a Comment