473,756 Members | 5,955 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Date/Time Question

Many scripts and calendars call client side system time in order to
make presentations.

However, the client's time may be improperly set, if set at all,
and/or the relevant time may be from another time zone.

It would be of great value if the time of some central source could be
drawn, in the form of a ".js" file, into the script to avoid
dependence on the client's date/time.

Even if such a central source produced a new file, extention ".js"
with such simple text as Date(,,) with the proper attributes of year,
month, day, hour and minute, a new file produced every 5 minutes (for
example), there would be a great many applications.

Does anyone know of such a source?

Is anyone interested in donating/hosting such a utility?
Even just a once every half hour genetor would have merit.

Please reply to ma*********@eas tontario.com (remove the _NOSPAM_ part)
Jul 20 '05 #1
5 2309
"Gord" <no*@eastontari o.com> wrote in message
news:31******** *************** ***@posting.goo gle.com...
Many scripts and calendars call client side system time in order to
make presentations.

However, the client's time may be improperly set, if set at all,
and/or the relevant time may be from another time zone.

It would be of great value if the time of some central source could be
drawn, in the form of a ".js" file, into the script to avoid
dependence on the client's date/time.

Even if such a central source produced a new file, extention ".js"
with such simple text as Date(,,) with the proper attributes of year,
month, day, hour and minute, a new file produced every 5 minutes (for
example), there would be a great many applications.

Does anyone know of such a source?

Is anyone interested in donating/hosting such a utility?
Even just a once every half hour genetor would have merit.

Please reply to ma*********@eas tontario.com (remove the _NOSPAM_ part)

The following uses ASP to return the current server-side timestamp; (watch
for word-wrap):

<% @Language="VBSc ript" %>
<% Option Explicit
Function TimeStamp()
'*
'* Timestamp() returns "ccyymmddhhnnss "
'*
Dim arrNOW(6)
arrNOW(0) = Now()
arrNOW(1) = DatePart("yyyy" ,arrNOW(0))
arrNOW(2) = DatePart("m",ar rNOW(0))
arrNOW(3) = DatePart("d",ar rNOW(0))
arrNOW(4) = DatePart("h",ar rNOW(0))
arrNOW(5) = DatePart("n",ar rNOW(0))
arrNOW(6) = DatePart("s",ar rNOW(0))
Dim intNOW
Dim strNOW
strNOW = ""
'*
For intNOW = 1 To UBound(arrNOW)
If (arrNOW(intNOW) < 10) Then
arrNOW(intNOW) = "0" & arrNOW(intNOW)
End If
strNOW = strNOW & arrNOW(intNOW)
Next
'*
TimeStamp = strNOW
End Function
%>
<html>
<head>
<title>TimeStam p.asp</title>
</head>
<body>
<%=TimeStamp()% >
</body>
</html>
Jul 20 '05 #2
JRS: In article <31************ **************@ posting.google. com>, seen
in news:comp.lang. javascript, Gord <no*@eastontari o.com> posted at Thu,
18 Dec 2003 08:06:36 :-
Many scripts and calendars call client side system time in order to
make presentations.

However, the client's time may be improperly set, if set at all,
and/or the relevant time may be from another time zone.

It would be of great value if the time of some central source could be
drawn, in the form of a ".js" file, into the script to avoid
dependence on the client's date/time.

The returned date/time needs to be GMT. For us, the best form would be
as a value of milliseconds since 1970-01-01 00:00:00 GMT, which can be
directly applied : var T = new Date(Number) or new Date(+String) .

There is no need for a _central_ source; reliable time, sufficiently
accurately, is available to servers worldwide.

Converting time between zones is AFAICS a solved problem, provided that
a valid TZ string can be supplied for each remote location, and that the
zone of a remote time us unambiguously indicated. See far below.

QHAH.
In article <5wkEb.80063$8y 1.286217@attbi_ s52>, seen in
news:comp.lang. javascript, McKirahan <Ne**@McKirahan .com> posted at Thu,
18 Dec 2003 16:23:29 :-
<% @Language="VBSc ript" %>


Which can be reduced using

s = Now
y = year(s) : ... : s = seconds(s)
TimeStamp = ((((Y*100+M)*10 0+D)*100+h)*100 +n)*100+s

assuming this VBscript is like what I have.
--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 20 '05 #3
Gord wrote on 18 Dec 2003 at Thu, 18 Dec 2003 16:06:36 GMT:
Many scripts and calendars call client side system time in order
to make presentations.

However, the client's time may be improperly set, if set at all,
and/or the relevant time may be from another time zone.

It would be of great value if the time of some central source
could be drawn, in the form of a ".js" file, into the script to
avoid dependence on the client's date/time.
The best central source is the Time server network. However,
JavaScript is unable to access such a resource. A Java applet or a
server-side language (that includes a Time protocol or Sockets
library) could with a bit of effort.
Please reply to ma*********@eas tontario.com (remove the _NOSPAM_
part)


Please read the FAQ for this group (http://jibbering.com/faq/),
particularly the sixth paragraph of article 2.3.

Mike

--
Michael Winter
M.******@blueyo nder.co.invalid (replace ".invalid" with ".uk")
Jul 20 '05 #4
In article <Eo************ **@merlyn.demon .co.uk>, Dr John Stockton
<sp**@merlyn.de mon.co.uk> writes:

<--snip-->
It would be of great value if the time of some central source could be
drawn, in the form of a ".js" file, into the script to avoid
dependence on the client's date/time.

The returned date/time needs to be GMT. For us, the best form would be
as a value of milliseconds since 1970-01-01 00:00:00 GMT, which can be
directly applied : var T = new Date(Number) or new Date(+String) .


Doesn't all of it still depend on the clients clock being set correctly?
Meaning, if local time is dependent on the users clock, and can be wrong, then
any other time would inherently be wrong?

I think what the OP wanted was some way to show what time it is, based on an
accurate time source, irregardless of the users time settings.
--
Randy
Jul 20 '05 #5
JRS: In article <20************ *************** @mb-m25.aol.com>, seen in
news:comp.lang. javascript, HikksNotAtHome <hi************ @aol.com>
posted at Thu, 18 Dec 2003 23:47:39 :-
In article <Eo************ **@merlyn.demon .co.uk>, Dr John Stockton
<sp**@merlyn.d emon.co.uk> writes:

<--snip-->
It would be of great value if the time of some central source could be
drawn, in the form of a ".js" file, into the script to avoid
dependence on the client's date/time.

The returned date/time needs to be GMT. For us, the best form would be
as a value of milliseconds since 1970-01-01 00:00:00 GMT, which can be
directly applied : var T = new Date(Number) or new Date(+String) .


Doesn't all of it still depend on the clients clock being set correctly?
Meaning, if local time is dependent on the users clock, and can be wrong, then
any other time would inherently be wrong?

I think what the OP wanted was some way to show what time it is, based on an
accurate time source, irregardless of the users time settings.

If one can import a current value for milliseconds since 1970-01-01
00:00:00 GMT, one can use it in at least two ways.

One can check that new Date() gives the same within some reasonable
tolerance, allowing for time taken to do the importing, and if they
differ by more than, say, 15000, do alert("I say, could your clock be
wrong?").

Or one can note the difference, and add it to the result of any
subsequent new Date() operation.
One can then show GMT as-it-is (relying on user's clock rate); a page
cannot show user's local time without relying on the user's zone
settings.

Since at a given instant there can be no more than 25 (hourly zones
-12..+12) + about 2 (zones wrong side of Line) + about 10 (fractional
hour offsets) correct readings for a local-time clock, a Web page
could however show them all. Just load the strings into the box of
<URL:http://www.merlyn.demo n.co.uk/js-date5.htm#SLHGD >.
AIUI, under standard conditions, a Web page (using HTML, javascript and
no more) obtained from domain A cannot read explicit data from arbitrary
domain B - e.g. as author I can frame or pop-up (?) a page of yours, but
I cannot read its words. I could, however, ask the reader to
copy'n'paste the date/time string off your page into my input control.

How, then, can such a page transfer a number from a co-operating alien
domain into a javascript variable? For time, to the second, one needs
32 bits; 8 Hex characters.

ISTM that script may be able to determine the size of an alien graphic?
If so, load 4 alien GIFs showing blankness, each of whose height and
width together encode 2 hex digits - max size only 15/16 square - and
decode.

Or make 32 requests http://X.Y.Z?n for n = 0..31, with only those for
which the current time has a 1 bit giving a response??

To avoid rollover uncertainty, gray-code the underlying 32 bits, which
also Grey-codes the Hex.

All untested.

--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 MIME. ©
Web <URL:http://www.merlyn.demo n.co.uk/> - w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demo n.co.uk/programs/> - see 00index.htm
Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm etc.
Jul 20 '05 #6

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

Similar topics

7
7211
by: What-a-Tool | last post by:
How does the expire date work setting it server side with asp. I know with javascript setting it client side it will be set to the clients local time, and therefore expire when the clients local time reaches the set expire-time. But if it is an expire time set on my server in California, and the cookie is put on a computer that is running on London Time, and the expire time is set at the server as 20 minutes from now, the London computer...
2
1578
by: mirza i | last post by:
thanks for the previous replies. here is the new question (i'm absolutely sure that this should be VERY easy for a good js coder) ok: from asp i call: <img src="pics/cal.gif" onclick="show_calendar_det('document.invdetdet.dx1',
7
4240
by: Jerome | last post by:
Hallo, I know a lot has already been told about date/time fields in a database but still confuses me, specif when dealing with SQLserver(Express). It seems that sqlserver only accepts the date in a "yyyyMMdd" format? (difference between Express and MSDE2000A ?) What is the one and only true way to deal with this problem in VB2005: Local settings are Dutch (Belgium) ; thus date is in "dd/MM/yy" (or perhaps dd/MM/yyyy) and time in...
13
16173
by: maflatoun | last post by:
Hi, I have the following function to convert UTC time to Local time. It works perfect for GMT- (Minus) time zones however it provides incorrect results for GMT+(Plus) time zones? // Format to local time from UTC function formatToLocalTimeDate(inDate) { var today = new Date(); var inDateMod = new Date(inDate);
6
12549
by: Luvin lunch | last post by:
Hi, I'm new to access and am very wary of dates as I have limited experience in their manipulation and I know if they're not done properly things can turn ugly quickly. I would like to use a calendar control to allow my users to enter a date but I need them to enter a time as well. It doesn't look like the calendar control will allow times to be entered so I was thinking of having two text boxes. One text box would contain the date...
44
10227
by: user | last post by:
Hi, Let's say I have 2 dates in the b/m format: Date 1 and date 2 How do I check whether Date2 is later than Date 1? Date1. 21-Nov-2006 09:00:00 PM
2
8734
by: John Dann | last post by:
I have a standard .Net DateTime variable to which I want to add a time value. The catch is that the time value is only readily available as a string as "HH:mm". Question is whether there's a simple construction that would do this. I'm thinking of something along the lines of: Dim MyDate as Date = New Date(1, 1, 2007) Dim MyNewDate as Date Dim MyTime as String = "HH:mm"
10
5821
by: ARC | last post by:
Hello all, General question for back-end database that has numerous date fields where the database will be used in regions that put the month first, and regions that do not. Should I save a date format in the table design, such as: mm/dd/yyyy? What I've done for years is to store the date format in date fields, then on the forms, based on their region, I would set the date formats on form_load
9
2940
by: Martin | last post by:
I'm retrieving some records from a database. One of the fields contains a date/time. I would like to format it as I send it out to the table in the displayed page. Can some one please tell me how I can/should do that? Or possibly point me to an on-line explanation? Thanks ps: if it makes any difference, the data is coming from a MS Access
6
3934
by: Geoff Cox | last post by:
Hello, at the moment I can add the combined date and time into MySQL using php $dt1 = date("Y-m-d H:i:s"); is it possible to add the date and time separately? I thought it might be
0
9456
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9873
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9846
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9713
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8713
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6534
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5142
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3806
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.