Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 18, 2013 09:49 PM by harrylynn
Jan 18, 2013 10:07 AM|LINK
This might sound a bit funny but I can't see to figure this out. Recently, I decided to work on a project and targeted country is different from the hosting environment but the application is going to be a time critical application. Something like stock
trading system but not exactly but you get what I mean.
My question is - i.e. in my code if I were to do DateTime.Now() , I am pretty sure it would give me the time of the web hosting country (U.S) but not the other country (Let's say China). How would I go about and achieve so that whenever I use DateTime.Now()
in my code, it would give me the current date and time of China instead of U.S ?
Appreciated if anyone could tell me. Thanks.
P.S I'm looking to go for discountasp.net for this project and I guess that's gonna be shared hosting.
Jan 18, 2013 11:31 AM|LINK
var now = new Date();
document.getElementById('hiddenfield').value = now.getTimezoneOffset();
use this hidden field in your asp.net code behind
Jan 18, 2013 05:33 PM|LINK
the system by changing my local computer's date and time, then do something. That is just my imgaination but I guess that kind of exploit can be easily done with that tweak. In my script, I use a lot of GETDATE() on the SQL side too.
Would appreciate if I would receive more input and solutions on the matter. Thanks all !
Jan 18, 2013 09:49 PM|LINK
I found the fix for my problem. It might not be the right solution but using UTC time method works for me. Figure out what is your targeted users country and then figure out how many minutes you need to add or subtract from the UTC time and insert it into
the database. Thanks.