Timezone

  • Thread starter Thread starter Sehboo
  • Start date Start date
S

Sehboo

I have stored datetime in UTC format in databases. I have one
database for each customer. Customers could be all over the US. They
connect to our website, and based on their profile, I know which
timezone they are coming from. Webserver is sitting in Chicago, but
customer could be coming from LA, NY, etc.

When I do .ToLocalTime(), it is converting the time according to
chicago's time, but I need to show the time in LA, NY, etc (depends on
where the customer is coming from).

I am not sure how to achieve this.
 
You need client side time, so your ToLocalTime() should execute as Client
side code, however that is done in ASP or ASP.NET. I think you are executing
a server side code.. I am not a expert in ASP.

VJ
 
alright, the you have to execute it on client side.. so I assume you have to
have a clientside script run in your HTML? If I am right?

VJ
 
you can't, but you can have a client side script in your web page's html,
that does the job for you.

Post in ASP.NET forum you might get a quick trick or tip on that.
VJ
 
Well that is not goint to work because we have about 100 pages with so
many fields on those pages with date/time. What I have at this point
is that in the guts of the system, I am changin the time to show the
localtime, but that local time is server's time (chicago), and not
NY's time where the customer is coming from.
 
Other way is if you know in ASP code where the client is coming form, then
write a switch statement do the time translation yourself.. Not the best
way, but may work for you considering the thick of things you are in.

VJ
 
VJ said:
Other way is if you know in ASP code where the client is coming form, then
write a switch statement do the time translation yourself.. Not the best
way, but may work for you considering the thick of things you are in.

You can probably store for each client, the time offset from GMT. Then you
won't need ugly switch statements, but a lookup for the client's timezone
and simple date/time arithmetic. GetSystemTimeAsFileTime returns the
current time in a format quite convenient for arithmetic, then you would
convert afterwards to year/month/day style for formatting.
 
Back
Top