For a one-time GPS week calculation, please go to the NOAA.gov website found here: https://www.ngs.noaa.gov/CORS/Gpscal.shtml. However, if you are trying to do this as part of your code, this would be inconvenient/inefficient.
Instead, you can find a toolbox on the same website: https://www.ngs.noaa.gov/gps-toolbox/bwr-c.txt
This has sample date-to-GPS time conversion code in C.
Additional resources can also be found here:
http://www.leapsecond.com/tools/gpsdate.c