Calculating the date difference is rather convoluted, considering that the HTTP specification allows three wildly different date formats.
What is the simplest way for a browser to construct an IMS (If-Modified-Since) header? Why, you send back the exact same string that you received from the server!
With this in mind, what is the simplest way for the server to determine how to respond to the IMS request? Do a simple string comparison between the IMS and the Last-Modified header! If they match, send a 304. If not, send the full 200.
If you make up your own date string, you're likely to get a 200 response, regardless of what the actual dates are.