Since the database field is a datetime datatype and I am converting the current date to string format, this is not working.. how can I do this? I am doing the string format because I want the date in mm/dd/yyyy format and not in mm/dd/yyyy hh:mm:ss time format..
i want show date like dd/mm/yyyy
but i dont why timestamp is showing like
dd/mm/yyyy 3:00 PM
(item.linedeptdt != null)
Vishal JoshiPosted Jun 11, 2024, 11:29 AM
Hello
you can try the below code to get expected result
Thanks
Vishal Joshi
Mrunali SawantPosted Jun 11, 2024, 12:09 PM
To display only the date part from a
datetimefield indd/MM/yyyyformat in ASP.NET, you can use theToStringmethod with a format string in your Razor view.Amit MohantyPosted Jun 11, 2024, 11:29 AM
If you prefer to handle the date formatting on the database side, you can use SQL queries to format the date before it is retrieved by your application.
Mukesh SagarPosted Jun 11, 2024, 11:25 AM
use this : SELECT CAST(GETDATE() AS date) AS DateOnly;