Solved

Time Zones on Client/Server Side

Posted on 2002-03-24
1
161 Views
Last Modified: 2010-04-01
i created a simple form with 2 columns for
date and time. the date and time is used for scheduling a job in the server. each column is composed of 2 combo boxes for month, day, year and the other one is hour, min and seconds. what i want to happen is, the page will dynamically pre select the current date and time based on the server, but already converted to the clients' timezone. using javascript and jsp. do u guys have some existing code for this task? thx :)
of course the data submitted to the server is already converted to the servers' timezone too.
0
Comment
Question by:ibo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
mark_at_serialmonkey earned 20 total points
ID: 7038368
There is classes in Java that let you do timezone conversions. Below is a snippet of code.

Date created = new Date();
TimeZone tz = SimpleTimeZone.getTimeZone("Australia/Sydney");
Calendar calendar = new GregorianCalendar(tz);
DateFormat df = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT);
df.setCalendar(calendar);
String formattedCreated = df.format(created);

This will format the created date object into a String which is in Australia/Sydney time format. You could also do the reverse I imagine using df.parse(). Have a look at the javadoc around these classes.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is in regards to the Cisco QSFP-4SFP10G-CU1M cables, which are designed to uplink/downlink 40GB ports to 10GB SFP ports. I recently experienced this and found very little configuration documentation on how these are supposed to be confi…
Part One of the two-part Q&A series with MalwareTech.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

626 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question