0

I am running a query in Vertica which returns a date as 2003-10-23 00:00:00

Now, In cs file, When I run filldataset to Dataset, the format get changes to '23-10-2003 00:00:00'

I want the exact format from database, As I tried to cast it as well but seems no result.

Jay
  • 165
  • 2
  • 14
  • I am not using datasets but as i recall in c# it have type for date of `DateTime` and when displayed it gets your localculture display format as default display. If you want to display it other way you need to set different culture/format for given column in dataset. – Aleksa Ristic Oct 10 '19 at 11:07
  • 1
    Possible duplicate of [Parse string to DateTime in C#](https://stackoverflow.com/questions/5366285/parse-string-to-datetime-in-c-sharp) – Kami Oct 10 '19 at 11:07
  • 3
    `DateTime` does not have a format. It is just a number. The format comes into play as soon (or late) as you are trying to _display_ it somewhere. – Fildor Oct 10 '19 at 11:12
  • database returned date format gets changed while filling dataset, if we want it as is then need to cast as date and again cast as varchar in query itself – Jay Oct 10 '19 at 14:58

1 Answers1

0

Date format returned from database gets changed according to our localculture display format while filling dataset, if we want it as it is then cast it as date and again cast as varchar in query, then fill the dataset in class.

Jay
  • 165
  • 2
  • 14