the_time function inside HTML dom parser

This is because shortcodes filter the content passed to the and replace based on the shortcode tag. In your case I recommend using get_the_time instead since it provides the same functionality but returns the value instead of echoing it. For more info on date formatting and args for this tag check out get_the_time