[time expression] + かかる [money expression] + かかる
[noun (purpose/destination)] + に + [time/money expression] + かかる
[verb (plain)] + のに + [time/money expression] + かかる
The verb かかる is used to express that something takes time or costs money. It describes the amount of time or money required for something.
To say how long something takes, use the pattern Time + かかる.
The particle に can mark the destination or purpose, while the time expression typically appears without a particle (or with the particle が when emphasizing the time itself).
To say how much something costs, use the pattern Amount of money + かかる.
The particle に is used to mark what the money is spent on.