It's actually a trick question, neither are correct.
The correct answer is either 4 p.m. or 4:00 p.m.
Whichever of those styles you prefer, there should be a space between the time and the "a.m." or "p.m." that follows.
I personally prefer the abridged 4 p.m. option, instead of including the zeroes (or zeros!).
In stories here, many people seem to be dropping both the periods and the space: "It was 4pm when..."
This is technically incorrect, but in common usage.
A sample of various style guides recommend the following:
The Associated Press Stylebook:
4 p.m.
Microsoft Manual of Style for Technical Publications:
4 P.M.
The Chicago Manual of Style and Garner's Modern American Usage:
4 p.m. or 4 PM (with PM in small capitals)
The Gregg Reference Manual:
4 p.m. or 4 P.M. (with PM in small capitals)
It doesn't put me off in the slightest seeing times as 10pm, 6am etc in stories, and it's certainly not grounds for rejecting a story.
How do you prefer to write the time? As long as people are consistent in their style, it's fine by me.