Strange behavior using DateTime.Now()

Hi,

I've an intranet application that's used over a VPN, and the application's users are in several different timezones.  One of the app's functions is to save the date when a record was created by saving the returned value from DateTime.Now() - pretty straight forward.

A user in the UK noted that the create date on a record he opened showed his local time in London.  This is wierd since the application is running on a server here on the east coast of the US.  I've verified that the code is in fact calling DateTime.Now() and not using clientside script to grab his local time.

Any thoughts on why this might be happening?

Thanks in advance, 

B

 

0
digimetic
4/23/2009 9:07:21 PM
asp.net.localization 2171 articles. 0 followers. Follow

2 Replies
580 Views

Similar Articles

[PageSpeed] 54

It is actually normal behavior of the DateTime.Now property.

It gives the date and time as it would appear to someone indicating what timezone they live in.

 

definition (MSDN): Gets a DateTime object that is set to the current date and time on this computer, expressed as the local time.


When you ask a question, remember to click "Mark As Answer" when you get a reply which answers your question.
0
Kulrom
4/23/2009 11:13:21 PM

hey, thanks for the reply.  but be careful about how you interpret that description (also avialable in the runtime help documentation).  the reference to "this computer" refers to the machine where the code is executed, i.e. the web server.

the problem in fact turned out to be a bit of javascript assigning a value to a hidden element - which was later read by server side code.  calls to System.DateTime.Now() weren't executed.

thx again, 

B

0
digimetic
4/29/2009 2:27:34 AM
Reply:

Similar Artilces:

Sending SMS using vb.net or C#.net using vb.net or c#.net
Hi  My requirement is I hav one csv file with these fields id,mobilenum,messgae,status.intiallu staus is 0. once i read the all fileds and take that mobile number.using tat mobile number  i need to send sms .after sending sms i shuld change status as 1 How to send sms thru coding (please dont provide any links.if it is provide also please give working links becox i checked codeproject .i didnt get any nice link. and also provide the how to update the status field im csv file   Thank ssandhya   To send SMS, you need some third party SMS providers. if you consul...

Insert datetime, using ADO.net VB.net
Hello there,I got a little code there are inserting a record into my msSQL database..But i cant insert the datetime, for one reason?The problem is in line 7 () where i want to insert DateTime.Now 1 Protected Sub SendPmTilAfviste(ByVal modtager As String, ByVal festID As String) 2 ' Connection 3 Dim conn As SqlConnection = New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True") 4 conn.Open() 5 6 ' SQL-kommandoen 7 Dim cm...

DateTime::TimeZone::Local uses File::Spec without use
DateTime::TimeZone::Local (from CPAN) is missing: use File::Spec; But later calls File::Spec->splitpath(...), resulting in the error: Can't locate object method "splitpath" via package "File::Spec" at /Library/Perl/DateTime/TimeZone/Local.pm line 44. -John On Wed, 18 Jun 2003, John Siracusa wrote: > DateTime::TimeZone::Local (from CPAN) is missing: > > use File::Spec; > > But later calls File::Spec->splitpath(...), resulting in the error: > > Can't locate object method "splitpath" via package &qu...

used a c#.net to vb.net converter and am now getting a syntax error.
ok I used a cool utility at http://www.kamalpatel.net/ConvertCSharp2VB.aspx to convert some c#.net to vb.net and it spit out a bunch of code which almost works but I am getting a syntax error on this line Imports (StreamReader sr = Shadows Function)() As StreamReader(objResponse.GetResponseStream()) I tried it that way and also like Imports (StreamReader sr = Shadows Function)() As StreamReader(objResponse.GetResponseStream()) but either way gave the same error Compiler Error Message: BC30035: Syntax error. Source Error: Line 26: Line ...

How to use DateTime.Now
I can not compare current date with date of last time a order was made...The error message is: "Conversion from string "d" to type 'Integer' is not valid"Please help.Thanks & Regds,Here is my code:Dim MyConnection As SqlConnectionDim MyCommandSistaaktivitet As SqlCommandDim Sistaaktivitet As ObjectDim SelectCommandSistaaktivitet As String = ("SELECT LastOrderDate FROM aspnet_Users WHERE (UserName = @UserId)")MyCommandSistaaktivitet = New SqlCommand(SelectCommandSistaaktivitet, MyConnection)MyConnection.Open()MyCommandSistaaktivitet.Par...

Strange behavior with localization
 Hi all, I got a strange behavior with the localization. I have got a website with 2 domain name. One for Spain one for a English. When member arrive on Spain website, the Theme change but not the language. And if I do just a refresh with F5. I got the good translation. Do you know how I can to do to force the translation in spain without refresh, please ?protected override void InitializeCulture() { if (Session["lang"] == null) { string lang = string.Empty; lang = ClassTheme.checkCulture(Request.Url.Host); ...

As DateTime = DateTime.Now....
Hello: I have a process that runs and would like to preserve the computer time inside of the variable when the process finishes. Using this method Dim dtDateTimeVar As DateTime = DateTime.Now the information inside the variable does not stay static and keeps changing with the time... what can I do to work around this?Need ASP.NET web hosting? Private Message me for a free quote. I have even tried something like this... Dim dtDateTimeVar as DateTime = DateTime.Now Dim varOldTime as String varoldtime = dtDateTimeVar It still gets the current time instead of the...

How to use net use?
Please can any one tell me how to use the dos command net use properly? I have read the help but can't seem to get it to work. Keep getting sytax error message. Thanks in advance. "Beowulf" <who-knows@no-one.com> wrote in message news:9krutk$puu$1@news.grc.com... > Please can any one tell me how to use the dos command net use properly? > > I have read the help but can't seem to get it to work. Keep getting sytax > error message. what are you trying to do? There are about 50 options to "net use" that do a ton of different thin...

datetime.now() and datetime.now().addmonths()..insert code run before.. but it doesnt run now... i have no done anything.. why dont it run itself ?
hi datetime.now() and datetime.now().addmonths().. it run before.. but it doesnt run now... i have no done anything.. why doesnt it run now ? my datatype is datetime.. what can problem be ? sds.InsertParameters.Add("ilanbaslangictarihi", DateTime.Now()) hello friends when i change 14.06.2008 to 10.06.2008 from my computer, inserting run for datetime.now() but when i change 10.06.2008 to 14.06.2008 from my computer.. inserting doesnt run for datetime.now() Also when i enter {0:dd/MM/YYYY hh:mm:ss} to formatstring of edit column of gridview, gridview display 33.06.2008 1...

Strange behavior using mailaddress()
Hi everyone, I've been using PB 10 for a little over a month, and have run into some strange behavior in the MAPI functions. My application is attempting to use mailsend() to bring up Outlook's address book so that the user can select recipients to CC on an email. The relevant code: from the window's open event: MailSession mSes mSes = create mailSession mret = mSes.maillogon() from ue_contacts event (called when the 'contacts' button is clicked) MailMessage m_replacement mSes.mailAddress(m_replacement) mMsg = m_replacement ------------------------...

Using Print -strange behavior
Hello All I installed Linux 8.0(kernel 2.4.18-14) and Perl V5.8.0 and when I try to run a Perl program with the line print "Hello World" it does not work, just perl executed it without an error. I checked it the script using perl -c script_name and it return OK Thanks --- Jose Luis Martinez <jlmartin_mx@yahoo.com.mx> wrote: > Hello All > > I installed Linux 8.0(kernel 2.4.18-14) and Perl V5.8.0 and when I try to > run a Perl program with the line > print "Hello World" > it does not work, just perl executed it without an er...

How to use DateTime.Now #2
I can not compare current date with date then last order was made.error message is: "Conversion from string "d" to type 'Integer' is not valid"Please help...Here is the code:Dim MyConnection As SqlConnectionDim MyCommandSistaaktivitet As SqlCommandDim Sistaaktivitet As ObjectDim SelectCommandSistaaktivitet As String = ("SELECT LastOrderDate FROM aspnet_Users WHERE (UserName = @UserId)")MyCommandSistaaktivitet = New SqlCommand(SelectCommandSistaaktivitet, MyConnection)MyConnection.Open()MyCommandSistaaktivitet.Parameters.Add("@UserId",...

Strange Listbox Behavior when using a Datasource
I have 2 Listboxes placed nexto each other with buttons bellow them to Add, Add All, Remove, Remove All.Both list boxes use a select query from a SQL 2005 table to get their values. Thats about up to where things behave normally. If I click Add, it should remove the selected item from listbox1 and add it to listbox2. It adds the item to listbox2, but doesnt remove it from listbox1. If however, I click remove on the newly added item, it will remove that item and place it back in listbox1, except there are now two entries in listbox1 with the same name/value. The add all and remove all bu...

Strange Crashing Behavior when SYSTEM used.
Hello, everyone, We have been using MacPerl for development for over a year, now, with fantastic results. Yesterday, we moved to a G4 Cube, 256M of RAM, 5G HD, MacOS 9.1 (prior OS was 9.0). Everytime we execute the MacPerl SYSTEM function to call into MPW, our system crashes with either a Type 1, Type 2, or Type 11 error. We are attempting to make MPW calls to a Perforce Depot. We've added a ton of RAM to each application. When we attempt to execute the same command(s) from the MPW cmdline, all was well. We tried executing a simple: $text = system "directory"; that worke...

Web resources about - Strange behavior using DateTime.Now() - asp.net.localization

Behavior - Wikipedia, the free encyclopedia
Behavior or behaviour (see spelling differences ) is the range of actions and mannerisms made by individuals, organisms , systems , or artificial ...

Behavior Design - behaviordesign.com
Behavior designs interactive systems.

Behavior Gap - Exploring the relationship between people and their money. Behavior Gap
Watch it now. Watch the latest videos by Carl Richards on money, emotion, and meaningful conversations.

Dog Behavior Tips -Dog Owners One Stop Shop and Tips
Come and get some free dog behavior tips. Training your new or older dog can sometimes be somewhat of a task if you are new to doing it. Let ...

Modeled Behavior
It is, more or less, the country’s primary check for determining how well the government is doing — and in fact what the government will be doing. ...

Online Behavior - Marketing Measurement & Optimization
This website is a source of knowledge for website owners and analysts looking to understand how their online customers behave . But that's not ...

BJ Fogg's Behavior Model
... In addition, he devotes at least half his time to industry projects and innovations, all of which focus on using technology to change behaviors ...

Plant Behavior
The Society of Plant Signaling and Behavior serves the community of scientists interested in sensory plant biology, signaling, information processing ...

Slightly creepy experiment with ants shows that drugs can permanently alter behavior
... researchers explain how the ant caste system works. Eventually, Simola and his colleagues found just a few enzymes that regulated the behavior ...

Human behavior is the biggest threat to company security
A new survey of cyber security professionals from information management company Nuix shows that businesses are placing greater emphasis on insider ...

Resources last updated: 1/8/2016 8:20:20 PM