473,788 Members | 2,676 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

time zone

Hi
I have a requirement to compare the user entry for mm/dd/yy/HH/mm
(month, day, year, hour, minute) to the Easter Standard Time.
I am using the following script, but it is not giving the right answer.
Your kind help is appreciated. Thank you!
//this is what user enters
var gdate = new Date(f.year.val ue, f.month.value, f.day.value,
f.hour.value, f.min.value);
var EST_offset = -4
var num_msecs = gdate.getTime() + gdate.getTimezo neOffset() * 60000
+ EST_offset *3600000;

//the current time of the desk top depends on location
var gdate2 = new Date();
var num_msecs2 = gdate2.getTime( )+ gdate2.getTimez oneOffset() *
60000;
//we don't know the offset from GMT! What does getTimezoneOffs et
return?

if (num_msecs < num_msecs2) {
alert("Schedule time has to be in the future");
return false;
}

Oct 5 '05
10 2707
JRS: In article <c0************ *****@news.optu s.net.au>, dated Thu, 6
Oct 2005 03:39:52, seen in news:comp.lang. javascript, RobG
<rg***@iinet.ne t.au> posted :

The second issue is that you are dependent on the client's local system
settings for date, time, region and daylight saving being correct which
they likely aren't in a good percentage of cases.


No, he only needs (given correct coding) that the client's idea of UTC
is correct.

Assume that the user is here in London with everything perfectly set for
local use at 18:00 on Midsummer's day, and enters particular YMDhms to
compare with current EST, which AIUI is Sydney Time. Let him then
instantaneously travel to Auckland NZ (making all of the date, time,
region, and season incorrect). He instantly re-enters the same data,
and exactly the same calculation should be done, since the relationship
between YMDhms and the current time in Sydney is not affected by the
questioner's location.

Since the OP called for a Standard (winter) time, there is no call for
the summer time rules.

OTOH, I'm not sure that he's properly expressed what he really wants
yet.

--
© 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.
Oct 6 '05 #11

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

Similar topics

2
6305
by: MLH | last post by:
I would like to be able to look up any 5-digit ZIP in a table that would show the correct time zone for the area. For example, I would like to look up 91915 in the table and see something that indicates Pacific Time Zone or 27615\ would be found as Eastern Time Zone. I guess I want Eastern Time Zone, Central Time Zone, Mountain Time Zone, Pacific Time Zone, Atlantic Time Zone along with Palau, Hawaii, Guam and all the others for the...
3
35104
by: Jon Davis | last post by:
The date string: "Thu, 17 Jul 2003 12:35:18 PST" The problem: // this fails on PST DateTime myDate = DateTime.Parse("Thu, 17 Jul 2003 12:35:18 PST"); Help? Jon
10
5269
by: Marc Pelletier | last post by:
Hello, I am writing an application that does some simple astronomical calculations. One of the variables I need is the number of hours passed in this year. I've written the following function public static double GetHoursofYear( DateTime aTime ) { DateTime StartYear = new DateTime( aTime.Year, 1, 1 ); return ( aTime.ToOADate() - StartYear.ToOADate() ) * 24;
2
24628
by: Avi | last post by:
I have a problem to get the different time zone's name for example I need the name of time zone UTC + 4:30 ("Kabul") The TimeZone.CurrentTimeZone get my current time zone name and I couldn't see how to get a different time zone name please hlp this is very important. Avi
1
2328
by: Clodoaldo Pinto Neto | last post by:
Hi all, I want to have the time zone string (like 'BRT') displayed after a date-time. The date column is of the type timestamp with time zone. But the time zone is not displayed. It works for a timestamp without time zone column: # select to_char(timestamp '2001-02-16 20:38:40' at time zone 'BRT', 'HH24:MI DD/MM/YYYY TZ'); to_char
14
2654
by: Cesar Ronchese | last post by:
Hello! I've built a program that show some dates to users. I got a problem when users have different configured time zone machines, where: - One machine that determined time zone the date displayed is 01/01/2006. - In other different machine (and other configured time zone), the date displayed is 12/31/2006 19:00:00 If I redefine the time zones of these two machines to the same, the date
2
14696
by: Mike | last post by:
I'm writing an application for Windows XP Embedded. This application requires that the user be able to change the time zone from within the application. I'm trying to do this using SetTimeZoneInformation, but it's not working correctly and I can't figure out why. I'm using Visual C# to write the application. The problem I'm having is that if I choose US Eastern Time (-5:00) Eastern Time (US & Canada) then the code below winds up setting...
3
2748
by: Satish Itty | last post by:
Hi all, I have a big problem in my hands and not sure how I can fix this. Any suggestions would be greatly appreciated. I have a .NET 3 tier app developed in VS2003 and .NET 1.1. the client is a windows application and middle tier runs on IIS. Data is passed between the client and middle tier as DataSets and custom value object classes. The problem in my hand is that the client application is deployed in different time zones and the...
7
5510
by: Steve | last post by:
Hi All I have a windows application written in VB.net 2005 The users have to select a State of Australia, which I use to check they have the correct windows time zone selected in control panel Dim myzone As TimeZone = TimeZone.CurrentTimeZone If they change the Time zone whilst my application is running, a new call to Dim myzone As TimeZone = TimeZone.CurrentTimeZone returns the same time zone NOT the new one They have to restart my...
7
2735
by: Correia | last post by:
I have a webserver that is in another country and have a different time zone. How can i fix this and use the scripts with the correct time zone? Thanks
0
9656
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
10366
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8993
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...
1
7517
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5399
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
5536
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4070
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
2
3674
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.