how do i get date time?

i need to collect date time of server.

how do i get that date and time. gives date and time of local machine of user browsing our website?

and it might be different since user can be from any location.

server date time will remain unique and there fore i need to collect server date time

so kindly tell me how do i collect server date time.


3/1/2008 2:50:21 PM 91979 articles. 4 followers. Follow

6 Replies

Similar Articles

[PageSpeed] 58

Depends on where the code is run.  If run at server, it shows server time.  If run at client, it shows client time.  Code is the same either way.


Please: Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue.
3/1/2008 2:54:18 PM

 DateTime.Now always gets the time from the server. Of course, if that server is on your local machine, the server time and local time will be the same. That's where you might be getting confused.

If you upload your web site to a new server in a different time zone, it will then show the time from THAT server. Anyone, anywhere in the world, would get the same value for DateTime.Now at any given time, regardless of where they are located. 

Visit my blog
3/1/2008 3:26:42 PM

Thanks Sir,

and how do we get client machine date time?

What actually I am doing is

whenever message is posted i have to show local date time of message posted.

if a user is in japan and another user is in America (i wont know actually where is user located )then they should see respective date time on their machine.

thus i want to save server date and time and when user sees that record i will find time gap of both amchine and then will be able to show local date time for the same.


i hope this is the correct way to achieve it or their is anyother way to do it?

3/1/2008 5:08:51 PM

 If you are on this site, look at the upper right corner. There is a link that says "Edit Profile".

If you do that, you will see a Site Options tab. There, you will see a place where the user can store his Time Zone in the profile.

When you make a post here at, the server stores the server time. But, the forum uses Time Zone info from the user profile to calculate the local time for display purposes.

This is the way it's usually done. So, you'd want to let the users indicate their time zone, and then have your program convert the stored server time of the message post to their own local time using date arithmetic. 

Visit my blog
3/1/2008 5:35:13 PM

Thanks Sir,

in my profile i can see my time zone

but i havent entered it.

thus only solution which i can see is

1) store time zone

2) use javascript

but in case user is not registered but views these messages then we need javascript.

is there a way (free) we can find time zone (geo location)thru coding?


3/1/2008 6:02:20 PM

There are services that allow you to return a geographical location from the IP, but that is not always reliable, and I'm not aware of any that are free.


Visit my blog
3/1/2008 10:34:17 PM

Similar Artilces:

Hi, I'm at a loss to explain this... I have an ASPX page that I can't always navigate to. When I developed the app (it's Starter Kit Portal-based), I did it on my LAN and have had no trouble accessing the page. However, upon deployment, I see the following behavior: 1. POST request goes out looking for MyForm.aspx 2. GET request for MyForm.aspx 3. GET request for MyForm.aspx 4. ... X. GET request Sometimes, the page finally loads. Other times, it just ends up blank. Many times, it doesn't load at ALL the first POST - I just get a "The pa...

trying to get started and i am getting this error
when i go to, i get: DotNetNuke Upgrade Error The Assembly Version ( [ASSEMBLYVERSION] ) does not match the Database Version ( [DATABASEVERSION] ) ERROR: Could not connect to database. Could not find file 'd:\hosting\nmoran26\Providers\DataProviders\AccessDataProvider\DotNetNuke.mdb'. Any suggestions will be appreciated. Thanks, Nicole Do you have a username and password set on your database? Make sure you follow the steps mentionned in the Readme.txt located in the documentation folder. In any case make sure your credentials for yo...

how to get start with .NET
the net help people installed  to my desktop 1-microsoft visual studio .NET enterprise developer 2003 2-microsoft .NET framework 1.1 what else do i need ...???  and how can i try with some simple code in VS.Net and run it to see wat happen...????? please help If you want to develope web applications, then you'll also need IIS on your PC.  That'll require XP-Professional or Windows 2000/2003, but XP-Home edition won't allow IIS installation. As for how to get started, you can search the web for some tutorials or buy a good book on VS.  The topic is way too vast to...

Getting Start With .net
hi i'm intersted to learn (vb or delphi) . i programming with delphi6 but i'd like to tp know something about programming in internet specially with .net . i hear about with delphi 7 that i can programming with delphi in .net .... is it right ? what 's our opinian about it ? and better to learn Vb.Net or continu with delphi(or thanks. Ali Darabian I think there is some support for Delphi in .Net. However, you will find much more support from the user community if you choose a more popular language such as VB.Net or C#. Since your al...

How to get date and time
Hi Every One I want present date and time with sends right now i am writing "DateTime.Now.ToString(); " it displays like "2008-12-26 22:35:00" but i want with seconds also like 2008-12-26 22:35:20   please help mePramoda Chakravarthy Vungarala Try this.. DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"); Check this link for more DateTime formats.. Blog"Don't be afraid to be wrong; otherwise you'll never be right."...

get date and time
hello i have 2 textbox on my page i want to get date and time in textbox3.text as soon as user enter the partnumber in textbox1.text thanks.   Client or server?  If client-side, are you limited to IE (that is, can you use VBScript)?Peter BrunoneMS MVP, ASP.NETFounder, EasyListBox.comDo the impossible, and go home early....

Getting error in Net::SFTP with get function
------=_Part_7028_3315294.1193837808284 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi All, I have the following code as part of my program; print "---=========> $file, $localFile\n"; $sftp -> get( $file, $localFile ) || warn("errrrr0rrrrr _---> $!".$sftp->status."\n");^M Even though it has downloaded the file properly, it is giving the following message: ---=========> /trading/tiscrdenhlist10310000.txt.old, /export/home/crdadm/rajeev/tiscrdenhlist103...

get rid of that ridiculous getting started bookmark
Name: DOCTOR Product: Firefox Summary: get rid of that ridiculous getting started bookmark Comments: Browser Details: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_4_11; en) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.2 Safari/525.22 From URL: Note to readers: Hendrix gives no expectation of a response to this feedback but if you wish to provide one you must BCC (not CC) the sender for them to see it. ...

getting started in VS2005 C# which book should I get
Hello, I am getting started with VS2005, I have use VS2003 but not very much -(I did 4 small applications in it),  I am wondering which book you would recommend to learn the new features of VS2005, while learning more of C# programing in general There some links to good books in this thread i posted : Also these two make good reference material  Professional Visual Studio 2005 (Programmer to Programmer)   Microsoft Visual Studio 2005 Unleashed  So far I recommend Wrox's C# 2005  Read the beginning chap...

How to get powerbuilder library version, date-time stamp at run-time?
Hi, We would like to see list of all libraries of running application along with their version and date/time stamp (in about window). We would like to get version number of compiled powerbuilder libraries (pbd's) at run-time. I don't know if pibbles compiled in dll format have advanced features (as regular dll - where right clicking on it and selecting properties will allow user to see version number of dll). Anyway, compilation of pibbles in dll format is not an option for us. I would like to see if anybody came across a solution and would like to share it with me. I ...

Where to start and how did you get started?
Hi, I have had a feeling for a long time to jump into the adds market for some time due to my low income (shooting for the stars) and I don't have anything better to do these days. But I find it really difficult not to give up due to lack of guides (what I can find atleast) and all the hard words which only makes me confused. But I won't give up. Never. Not sure if this is the right place to post this, but I deffinitly would be really greatfull for help getting started. How did you get started? +If there are any teacher that wanna show me the ropes private, I can give payment with ...

How to get week start date, End date for a given week nunber,year?
I want  a javascript function to to get the starting date and end date of a week when I have given the week number (1 to 5), Month number (1 to 12), valid year as parameter. How to do that?Manivannan  You can visited dont have example.Hope it's help you. try this example function GetWeekStartEndDate(){    var week = 5;    var month = 4;    var year = 2008;        var PositiveOneDay = new Date(new Date('1/2/2000') - new Date('1/1/2000'));   &...

Hello There!,          First of all i have a date column and a text box column in my datagrid . i am populating the date column through the below code  DataTable Table3 = new DataTable();         DataColumn Date = new DataColumn();        Date.ColumnName = "Date";   Table3.Columns.Add(Date);  DateTime Crnt_Time =DateTime.Now;        int day = Crnt_Time.Day;        int mnth = Crnt_Time....

Problem Getting Started
In have run the 1317set.bat file and still get the following error: Unable to get your db version please run version script against your db and restart your web application (go to update/scripts/ folder and run 1317set.bat). Any help to get me started would be much | Have you checked your connection string? This is sometimes caused by a faulty db connection. I am new to Rainbow and get the same error when trying to run it for the first time. Does not matter which of the following I comment out in web.config: <!-...

Web resources about - how do i get date time? -

Time - Wikipedia, the free encyclopedia
Two contrasting viewpoints on time divide many prominent philosophers. One view is that time is part of the fundamental structure of the universe ...

Time - Wikipedia, the free encyclopedia
Two contrasting viewpoints on time divide many prominent philosophers. One view is that time is part of the fundamental structure of the universe ...

Altus Times -
Local News, Sports, Obituaries, and Classifieds for Altus, OK Toggle navigation Altus Times Altus Times HOME NEWS SPORTS OBITS OPINION FEATURES ...

Asia Times Online :: Asian news hub providing the latest news and analysis from Asia
Asia Times Online. The Asia News Hub providing the latest news and analysis regarding economics, events and trends in business, economy and politics ...

The Asheville Citizen-Times - Asheville news, community, entertainment, yellow pages and classifieds ...
Asheville North Carolina News - is the home page of Asheville North Carolina with in depth and updated Asheville local news. ...

electrical engineering, electronic engineering times, ee times, news, analysis, electronic design, products ...
Electronic Engineering Times is the industry resource for news, analysis, design ideas & solutions, products, education, & engaging with the ...

Local News, Community Events, Area Information - Fort Mill Times - Fort Mill, SC
DLS Retreading, which retreads truck tires, said today it has opened a manufacturing, warehousing, sales and service facility in Indian Land. ...

Corvallis Gazette-Times
BLOOMINGTON, Ind. — West Albany senior-to-be Rachel Proteau finished in a tie for fifth place in the high jump by clearing 5 feet, 7 inches on ...

Latest Design Trends, Current Design Trends - International Design Times
International Design Times Inc. is the leading provider of trendy arts and designs in the United States and around the world. It provides online ...

The Irish Times - Breaking Local and International News from Ireland
Find the Latest Local and International News including Sports, Analysis, Business, Weather and more from the Definitive Brand of Quality News ...

Resources last updated: 12/30/2015 9:12:22 AM