Check out what
Swift has there. If you want to know
incredibly technical stuff about time on Mars, check out the subsection
here, perhaps reading this primer
here first. You'll note that both Michael Allison and Robert Schmunk are involved in both; apparently they literally wrote the book on Mars time.
The primer I mention above should be all you need, but for those just browsing, I'll type a bit more. I was messing with Javascript, making a clock for PST conversion (as it got annoying hearing the NASA TV announcer list times in PST only). The most interesting thing I found in my research is that lander time is determined by the solar time at the exact location they land at. At the time they land, the preceeding midnight is declared to be zero time, and that day is "Sol 1" for that mission.