Institutional Knowledge

Wherein we write down some stuff that we know.

Institutional Knowledge header image 2

Time

April 10th, 2006 · No Comments

Dear America,

Please switch to 24 hour time. It makes sense and it’s easier for coding. I’m tired of implementing this logic in all my applications and deal with time.

RUBY:
  1. def ampm(hour)
  2.     case hour
  3.       when      : “12 am”
  4.       when 1..11 : ”#{hour} am”
  5.       when 12    : “12 pm”
  6.     else         ”#{hour-12} pm”
  7.     end
  8.   end

It just drives me crazy sometimes…

Tags: Web Development