Can I say both sentences at 5 pm of current day.i seriously don't understand. I know perfect is used for show effect of past action on present and simple past is completely detached from present.still can someone clarify when to use which of these sentences.
Either is fine, although I think the second is a bit more idiomatic.
"Did you see him today" would imply that there you would expect to have seen him on a particular occasion during the day - such as a regular meeting where he would normally attend.
"Have you seen him today" is more general, asking for example if you saw him walk past your desk at any point during the day.
"Did you see him today" refers to a moment in the past, for example this morning, this afternoon (anytime before 5 pm) and it implies you will not see him for the rest of that day. He or you left earlier, for example.
"Have you seen him today" refers to the day up until now, 5 pm, and it implies you might see him later that day.