in table having only date but after exporting in excel it is showing date with time how to remove time in excel
eg:in table date column :
date
11/12/2023
date in excel sheet:
date
11/12/2023 10:11:00 pm
excepted output in excel sheet should be like this only date :
11/12/2023
Pratik PatelPosted Mar 30, 2023, 9:08 AM
In the SQL Server, Here is multiple options for removing time from datetime column. We can use CONVERT or CAST function by converting the datetime to date type only.
For Example
DECLARE @CurrentDate DateTime = GetDate()
SELECT @CurrentDate As CurrentDateTime
--OptionNo.1
SELECT CONVERT(DATE,@CurrentDate) AS OptionNo.1
--OptionNo.2
SELECT CAST(@CurrentDate AS DATE) AS OptionNo.2
--OptionNo.3
SELECT CONVERT(char(10), @CurrentDate,126) AS OptionNo.3
Raj BhattPosted Mar 30, 2023, 6:16 AM
Hello ,
Please Try This
Meghana MPosted Mar 30, 2023, 2:33 AM
date format is correctly displaying in excel but date is not proper
Rajkiran SwainPosted Mar 29, 2023, 8:20 PM
Ali BenchaabanPosted Mar 29, 2023, 1:48 PM
Hello Meghana,
Try to use select convert(nvarchar, "your date column name ", 103)
BENCHAABAN Ali