Displaying the date of the customer, in accordance with its Time zone

  • Thread starter Alexander Vasilevsky
  • Start date
D

Duy Lam

Alexander said:
Need to display the date of the customer, in accordance with its Time zone

http://www.alvas.net - Audio tools for C# and VB.Net developers + Christmas
gift

Maybe this code helpful:

string dateString = DateTime.Now.ToString(
System.Threading.Thread.CurrentThread.CurrentUICulture.DateTimeFormat.LongDatePattern
);
 
E

Eliyahu Goldin

You code runs on server. It has no knowledge about the client machine
timezone. You need to get in on client side with a javascript call

Date.getTimezoneOffset()";

the pass the value to server side in a hidden input control.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
 
M

Mark Rae [MVP]

string dateString = DateTime.Now.ToString(
System.Threading.Thread.CurrentThread.CurrentUICulture.DateTimeFormat.LongDatePattern);

Only if the client and server happen to be in the same time zone...
 
D

Duy Lam

Mark said:
Only if the client and server happen to be in the same time zone...

If Alexander want display date in browser, it certainly should use
javascript to do.
I'm sorry because i only think this require run on one machine although
this group is aspnet :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top