Yes, there's a formula (a 2x2 matrix with cosines on the diagonal, sine and -sine off the diagnoal), but you should know how to get that result. Memorizing this can be tricky, because it's easy to put the negative sine in the wrong matix, depending on the direction of the angle of rotation and which bases are the domain and which are the range of that matrix multiplication.
This is all about drawing a picture, and breaking down your new (just rotated) unit vectors into compinetns in terms of the original unit vectors. You'll have right triangle with hypotenuse of length 1, and an angle in the triangle. Then use sine = opposite/hypotenuse, cosine = adjacent/hypotenuse to get those coeficients. Then the thing to watch for is the +/- signs. This is the kinda thing that, after you do a few, seems pretty simple. Watching if the signs make sense is the only part that requires any great care.
For me, I check my work by comparing it to the standard example of rotating the standard basis vectors in the x and y directions counter clockwise by an angle less than 90 degrees. The new basis vectors should have all of their signs positive, except the x-coordinate of the rotated y-direction vector.