Updated code to show msg according to time