Monday, April 25, 2011

.NET Date Format Conversion in Oracle Format

Hey guys...recently i was facing a small problem of converting the system date to the format that oracle accepts..Oracle date is format sensitive.

.NET has the format 'mm-dd-yyyy' and oracle has the format 'dd-MMM-yy'

So I passed the System.datetime.now as parameter _date.

Then we just need to do this..

string _str = _date.ToString("dd-MMM-yy");

_str has the value in format "dd-MMM-yy"

and to all of those who don't kow that oracle accepts date as a parameter in quotes.

eg. '21-APR-11'

I hope this helps...

No comments:

Post a Comment