strftime is always showing am for times (even for "pm" time also) for every datetime entry in rails -


iam saving current date , time in database checkin time in db. using time.now. , when query database iam getting time in "am" time in "pm" also.

 @curr_emp_attendace = current_employee.punch_in_outs.where("year(check_in) = ? , month(check_in) = ?",time.now.strftime("%y") ,time.now.strftime("%m") ) 

and in view iam displaying <%= attendace.check_in.strftime("%a %d, %h:%m %p") when display iam getting "am" time (for times in "pm") also. might reason iam not understanding.

try this:

@curr_emp_attendace = current_employee.punch_in_outs.where(:check_in => time.now) 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -