If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Enjoy an ad free experience by logging in. Not a member yet? Register.

Help With timezone javascript output

Greetings,
Firstly let me state that i dont have any experience with javascripting.

Well i Have been using this javascript code for me site and everything works fine with the timezoe convervion.
Only thing is If i input the times in 12Hr format Ie. 4:45 or 4:45 pm it displays in the same format, If i try input the time as 24hr format I.e. 16:45 or 16:45 pm it displays the 12hr output ie. 4:45 pm

Can anyone please help with changing the script below to output the info to the user in 24 hr format, Or how i can input the time into the script so that it displays in 24 hour format.

If anyone is abale to assist in telling me which values must be changed to which in the js file or able to even do the changes for me or explain how to display the output in 24hr format would be greatly apreciated.
Thank you for your time
Kind Regards

Hi , Been reading through forums and trying what people are saying but still nothing seems to be helping

Maybe This will help more, I have compiled a little html of to show you what i am needing the function to do.
NUMBER 1

1) Below is Html code for The orginal Script i was asking about, You can see that the input time is "16:45"... If you save this code and display the page you will notice that the time will change from 16:45 GMT/UTC+1 to your(user) timezone. Hence if you are GMT/UTC -4 the time will show as 11:45 AM or If you are GMT/UTC +3 it will show as 6:45PM... So the timezones are correct and working..

The time format displayed on the website needs to be ''Project Due 19:45'' or ''Project Due 11:45''.. and not show "Project Due 7:45PM" or "Project Due 11:45AM"... (notice how the first ones are in 24 hours clock mode and not 12 hour clock mode.. No PM or AM needed)

When using the same code below with that script. I get the same time format displayed back i.e 16:45 which is what i want.. Great.. But no matter what time i enter in the html code, The time Displayed is not correct for my timezone GMT+2 and I keep getting the same time output no matter what time of the day is the input

Im not to sure if the 2nd one requires any other scripts installed on the server or anything, Or if The timezone-data.js needs more informatin like zones etc. Where the 1st one just seems to work with the timezone converting.

Unfortunately this is the best and easiest i can seem to lay it out and with not much experience with scripting, If anyone is able to help it would be greatly appreciated..

sorry, I misunderstood you initially, but now I understand that you want to display a fixed time, but in the users' time zone (and in 24 hour format) and that the time you specify is specified with London's timezone (UTC+0) – correct? What about daylight savings time?

Users who have thanked Airblader for this post:

Hi Airblader, No worries, I dont explains things very well, lol but glad someone is finally understanding what i mean. Yes that is correct and whta im trying to do.

Yes i would need to add daylight savings, but will have to have a look, i think you may be on to something there though, As london is now UTC+1.. It will will only become UTC 0 Later this month i think. then it would be 2 hours at the moment they only 1 hour behind me.

The id attribute has to be unique, you cannot reuse it. I modified it so that it uses classes and automatically converts any time on the page that is marked with that class. Since the script you used before uses jQuery, I assume you already have jQuery loaded, because the new version requires it: --removed--

Edit: Actually I just noticed that the script you used automatically loads jQuery itself (and a very outdated version of that). It's sort of overkill to load the entire library just for this purpose, so here is another updated version without jQuery: http://jsfiddle.net/wJGvb/3/

While it's very nice of you to wanting to pay me, it's really not necessary. I'm in forums like these to help, in order to make money I go into work everyday.