Change WordPress date format for comments in Astra

  comments, date, formatting, php, wordpress

my problem is very simple but I am not familiar with PHP. My goal is to change the date format for the comments in my WordPress blog from "26th of February 2021 at 12:23" to "43 minutes ago".

I also found a code snippet that does this for me, but it doesn’t render the markup like the code which is provided by the theme itself.

This is the code provided by Astra:

    '<div class="ast-comment-time ast-col-lg-12"><span  class="timendate"><a href="%1$s"><time datetime="%2$s">%3$s</time></a></span></div>',
    esc_url( get_comment_link( $comment->comment_ID ) ),
    esc_attr( get_comment_time( 'c' ) ),
    /* translators: 1: date, 2: time */
    esc_html( sprintf( __( '%1$s at %2$s', 'astra' ), get_comment_date(), get_comment_time() ) ),

This is the code I found:

printf( _x( '%1$s ago', '%2$s = human-readable time difference', 'wpdocs_textdomain' ),
    human_time_diff( get_comment_time( 'U' ),
    current_time( 'timestamp' )

I’d be more than happy if someone could help me with this since I don’t know where to search for a solution anymore…

Thank you all!

Source: Ask PHP