oshirowanen
oshirowanen

Reputation: 15925

Formatting data returned via datareader

I am returning a date from my database table:

objSQLDataReader("date")

Which gives me:

31/05/2011 16:00:50

How do I change this to:

31 May 2011

?

Upvotes: 0

Views: 2149

Answers (3)

DOK
DOK

Reputation: 32841

I think it would be a lot easier to format it in your SQL than to deal with it afterward.

SELECT CONVERT(varchar(25),GETDATE(), 106)

Here's a whole list of date formatting choices.

Upvotes: 1

Rubens Farias
Rubens Farias

Reputation: 57956

((DateTime)objSQLDataReader("date")).ToString("dd MMMM yyyy")

Upvotes: 3

Darin Dimitrov
Darin Dimitrov

Reputation: 1038930

someDateInstance.ToString("dd MMMM yyyy")

Upvotes: 2

Related Questions