'How to extract field in <a> as JavaScript parameter?

Chrome adds a date added field in the links to exported bookmarks

    <A HREF="https://dex.xrplapps.com/asset.php?ID=CSC" ADD_DATE="1621604954"> xrplapps.com</A>

The format etc. is covered here.

Google Bookmark Export date format?

The javascript conversion provided, while excellent, just inserts an arbitrary value

    function ConvertToDateTime(srcChromeBookmarkDate) {
        //Hp --> The base date which google chrome considers while adding bookmarks
        var baseDate = new Date(1601, 0, 1);

        //Hp --> Total number of seconds in a day.
        var totalSecondsPerDay = 86400;

        //Hp --> Read total number of days and seconds from source chrome bookmark date.
        var quotient = Math.floor(srcChromeBookmarkDate / 1000000);
        var totalNoOfDays = Math.floor(quotient / totalSecondsPerDay);
        var totalNoOfSeconds = quotient % totalSecondsPerDay;

        //Hp --> Add total number of days to base google chrome date.
        var targetDate =  new Date(baseDate.setDate(baseDate.getDate() + totalNoOfDays));

        //Hp --> Add total number of seconds to target date.
        return new Date(targetDate.setSeconds(targetDate.getSeconds() + totalNoOfSeconds));
    }

    var myDate = ConvertToDateTime(13236951113528894); // <<< Arbitrary Value <<<<
    alert(myDate);

How to;

  • extract the value from the field to insert in the myDate var
  • while extracting only the specific one from the link in the current

E.g.

            <DL><p>
                <DT><A HREF="https://dex.xrplapps.com/asset.php?ID=CSC" ADD_DATE="1621604954"> xrplapps.com</A>
                <dd>Description: XRP Ledger Asset Statistics</dd>
                <dd>Date Added: ConvertedDate</dd>
                </DT>
             </DL>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source