how to set timestamp in datetime field if the time is not specified?
There's a few ways. Here's one.

declare @startDate datetime = '20180114'

if @startDate = cast(@startDate as date)
begin
    set @startDate = dateadd(second,-1,dateadd(day,1,@startdate))
end

select @startDate