Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 13th, 2011, 08:15 AM
Friend of Wrox
Points: 547, Level: 8
Points: 547, Level: 8 Points: 547, Level: 8 Points: 547, Level: 8
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2010
Posts: 125
Thanks: 20
Thanked 3 Times in 3 Posts
Default Server and Client Time difference

Hi there,
When You run DateTime.Now.ToString() in your PC browser, it shows the correct time. However, When You run it on Server the time is not correct(But date is correct). Because in last case you receive server(maybe in another country ) time but in first case you receive You PC time. How we can calculate the difference time between server and client?
__________________
Please excuse me for poor and bad English.
Reply With Quote
  #2 (permalink)  
Old September 13th, 2011, 02:38 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Quote:
When You run it on Server the time is not correct(But date is correct).
The date could be "wrong" as well as the day has already changed in one timezone but not yet in the other.

But it all depends on what you mean with "correct" and "wrong". If I as a visitor were in the same time zone as the server it could be right for me....

You can take a look at ToUniversalTime on the DateTime struct (http://msdn.microsoft.com/en-us/libr...(v=vs.71).aspx) which gives the universal time regardless the timezone. Then you can calculate back to the user's time zone if you have that information (could base it on an IP address, or ask the user's timezone as these Wrox forums do it).

For future questions like these that are not directly related to my book, would you mind posting in a more general ASP.NET category from this list:http://p2p.wrox.com/asp-net-4-539/

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #3 (permalink)  
Old September 13th, 2011, 02:43 PM
Friend of Wrox
Points: 547, Level: 8
Points: 547, Level: 8 Points: 547, Level: 8 Points: 547, Level: 8
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2010
Posts: 125
Thanks: 20
Thanked 3 Times in 3 Posts
Default

Quote:
For future questions like these that are not directly related to my book, would you mind posting in a more general ASP.NET category
I am sorry, in future post i care about it.
Thanks for your help. It help me.
__________________
Please excuse me for poor and bad English.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculating a time difference SQLScott SQL Server 2005 11 October 25th, 2007 02:42 AM
difference in time MunishBhatia ASP.NET 2.0 Professional 0 September 5th, 2007 09:03 AM
Difference between client edition and server editi pybrajesh SQL Server 2005 1 October 5th, 2006 10:34 PM
DLLs on server pulling server time or client? mussitsch Classic ASP Professional 1 March 1st, 2005 05:38 AM
Time difference spraveens PHP How-To 4 September 20th, 2004 07:00 AM



All times are GMT -4. The time now is 02:18 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.