Depreciation is the accounting method used to spread the expense of purchasing a fixed asset over the time it is used. As GAAP and IFRS try to follow the matching principle, depreciation matches the expense of an asset to the same time period during which the asset is providing revenues. If a tangible asset is expected to provide value to an organization for more than one accounting period, then it should be capitalized and expensed over that period of time using a depreciation method.
As a practical expedient, book (not tax) depreciation is typically calculated on the straight line basis. This involves a relatively simple calculation which outputs an expense amount for each period which can be days, months, quarters, etc.
If you had a company policy of computer equipment having a useful life of three years, the calculation would be to divide the acquisition cost by 36 months and multiply the result by the number of months in the period.