473,407 Members | 2,314 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Show time as text E.g. 40 min ago

Hi,

Many web sites e.g. Writely show when the document was last changed.
Has anybody a javascript which converts a date time stamp into such a
textual representation?

Thanks,
Reto
www.xcellery.com

Aug 23 '06 #1
2 1213

Reto wrote:
Hi,

Many web sites e.g. Writely show when the document was last changed.
Has anybody a javascript which converts a date time stamp into such a
textual representation?
It seems to me that that type of functionality should be done on the
server. If you use JavaScript and the client system date/time, you are
hoping that the clocks are reasonably synchronised. You also have to
ensure that the two timestamps are reduced to a common datum before
calcuating the difference.

If you try to avoid those issues by sending a current timestamp from
the server in addition to the timestamp for the document and then use
script to calculate the difference client-side, you might as well do
the maths on the server and just send the time difference.

If you want to go ahead with a JavaScript solution, pretty much
everything you need is here:

<URL: http://www.merlyn.demon.co.uk/js-date0.htm >
--
Rob

Aug 24 '06 #2
Thanks Rob,

Yes you are probably right. It's better to compute this on the server
side in order to base it on the same time reference which will be the
server.

Thx,
Reto
www.xcellery.com

RobG wrote:
Reto wrote:
Hi,

Many web sites e.g. Writely show when the document was last changed.
Has anybody a javascript which converts a date time stamp into such a
textual representation?

It seems to me that that type of functionality should be done on the
server. If you use JavaScript and the client system date/time, you are
hoping that the clocks are reasonably synchronised. You also have to
ensure that the two timestamps are reduced to a common datum before
calcuating the difference.

If you try to avoid those issues by sending a current timestamp from
the server in addition to the timestamp for the document and then use
script to calculate the difference client-side, you might as well do
the maths on the server and just send the time difference.

If you want to go ahead with a JavaScript solution, pretty much
everything you need is here:

<URL: http://www.merlyn.demon.co.uk/js-date0.htm >
--
Rob
Aug 24 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
by: WindAndWaves | last post by:
Hi Gurus I was wondering if you can send me in the right direction: I have a table with about 300 rows. I want to make all of them invisible and when a user enters a code in a form then make...
15
by: Paul T. Rong | last post by:
Hi everybody, This time a very very difficult case: I have a table "tblStudent", there are 50 students, I also made a form "frmStudent" based on "tblStudent", now if I don't want to show all...
0
by: Jason | last post by:
What interface do I need to implement in order to get a component with a public property to show up in the data binding drop down boxes at design time in VS.net? I've tried to look just about...
2
by: Jim | last post by:
My browser doesn't show text boxes, labels etc. It seems that it doesn't read the script at all (C#). I use the following program (from a wrox book): <----------------------------------------...
0
by: Lucian Wischik | last post by:
I'm using ToolTip.Show(x,y,..) to show my balloon-style tooltip at a specified coordinate. Most of the time it works fine and the "tip" of the balloon points exactly to my specified (x,y)...
3
by: aldonnelley | last post by:
Hi all. Just having a weird problem with tkinter. I'm trying to make a gui that shows results from an image search, with a "forward" and "back" button so the user can compare results from...
1
by: sjvandevoorde | last post by:
I need some help with a couple forms/test fields. Bare with me I have been out of the field for some time and only consider myself an intermediate user. The first one is a subfrom which lists...
12
by: lawrence k | last post by:
I've a form that starts off like this: <form method="post" action="profile.php? id=5&formName=my_story_edit.htm" enctype="multipart/form-data"> <p>Email address:<br /> <input type="text"...
1
by: simonyong | last post by:
hello, everyone Sorry for disturb.. im newbie to asp.net im trying to do a task that as below: In a SAME datagrid, it ll show all data when user key in key word in textbox... datagrid will...
3
by: timplx | last post by:
Hello all, New to javascript and have never worked with programming languages like c++, so my logic in some of these statements might be incorrect or redundant Got a problem with my page......
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.