added more logic for displaying the value

determining format according to the displayDate and displayTime settings