Hi,
I retrieves the date field as '2022-11-11T00:00:00+05:30', when fetches from Sql table, but need only date as '2022-11-11'
Can you plz suggest how to get the same using the format with C# code or sql.
Thanks
Sathish
Hi,
I retrieves the date field as '2022-11-11T00:00:00+05:30', when fetches from Sql table, but need only date as '2022-11-11'
Can you plz suggest how to get the same using the format with C# code or sql.
Thanks
Sathish
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Vishal JoshiPosted Nov 22, 2022, 11:07 AM
Hello Sathish,
You can try the below way to get only Date from the DateTime.
Thanks
Jignesh KumarPosted Nov 22, 2022, 11:40 AM
use this one in sql query CONVERT(char(10), orderedDate ,126),
Rajanikant HawaldarPosted Nov 22, 2022, 10:38 AM
https://www.c-sharpcorner.com/blogs/date-and-time-format-in-c-sharp-programming1
Naresh BeniwalPosted Nov 22, 2022, 10:27 AM
https://stackoverflow.com/questions/3025361/c-sharp-datetime-to-yyyymmddhhmmss-format