well you could try localtime.

ifyou already have the time from the user then you need to subtract it like you said, but how would you know to subtract it or add it?