473,327 Members | 1,930 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,327 software developers and data experts.

Date Formats

I have some Javascript in a Filemaker file that basically sets a timer and or alarm It works perfectly in the file I was given to dowload USA based but when I import it into my local UK file it does not work The Timer is prob easiest example to show

When I add 1 minute in UK file it shows 13145 hours plus 1 minute

How do I convert the date formats please Timer etc are just fields in Filermaker
Expand|Select|Wrap|Line Numbers
  1. "data:text/html,<html>
  2. <head>
  3. <script type='text/javascript'>
  4.  
  5. /*Setting JavaScript Variables to value of FileMaker fields*/
  6. var targetTimeTxt = '" & Timer::Timestamp_End & "';
  7. var status = '" & Timer::Status & "';
  8. var labelTxt = '" & Timer::Label & "';
  9. /*End FileMaker Fields*/
  10.  
  11. var currentTime = new Date();
  12. var targetTime = new Date(targetTimeTxt);
  13. var remaining = Math.floor((targetTime - currentTime)/1000);
  14.  
  15. function setClock()
  16. {
  17.     var currentTime = new Date();
  18.     var clock = document.getElementById('clock');
  19.     var labelobj = document.getElementById('label1');
  20.     var secondsRemaining=0;
  21.  
  22.     if(labelTxt=='')
  23.     {
  24.         labelobj.innerHTML='Timer';
  25.     }
  26.     else
  27.     {
  28.         labelobj.innerHTML=labelTxt;
  29.     }
  30.  
  31.     if (targetTime>currentTime)
  32.     {
  33.         secondsRemaining=Math.floor((targetTime - currentTime)/1000);
  34.     }
  35.  
  36.     var hours = Math.floor( secondsRemaining / 3600 );
  37.     var minutes = Math.floor((secondsRemaining%3600) / 60 );
  38.     if(minutes<10)minutes='0' + minutes;
  39.     var seconds = secondsRemaining%60;
  40.     if(seconds<10)seconds='0'+seconds;
  41.  
  42.     clock.innerHTML=hours + ':' + minutes + ':' + seconds;
  43.  
  44.     if(targetTimeTxt=='' || status=='Acknowledged' || ( secondsRemaining==0 && Math.floor(currentTime/1000)%2==0 ) )
  45.     {
  46.         document.body.style.backgroundColor='#FFFFFF';
  47.         if ( targetTimeTxt=='' || status=='Acknowledged' )
  48.         {
  49.             clock.innerHTML='--:--:--';
  50.         }
  51.     }
  52.     else if(secondsRemaining==0)
  53.     {
  54.         document.body.style.backgroundColor='#FFFF00';
  55.         document.getElementById('sound1').Play();
  56.     }
  57.  
  58.     setTimeout('setClock();',1000);
  59. }
  60.  
  61. </script>
  62. </head>
  63. <body style='margin:4px;padding:0;font-size:14px;font-weight:bold;font-family: Arial, Helvetica, sans-serif;text-align:center;background-color:#FFFFFF;' onload='setClock();'>
  64. <div id='label1' style='font-size:10px;font-weight:bold;'>
  65. </div>
  66. <div id='clock'>
  67. </div>
  68. <embed src='file:///System/Library/Sounds/Glass.aiff' autostart='false'  id='sound1'
  69. enablejavascript='true' width='0' height='0'>
  70. </body></html>"
Jan 21 '12 #1
1 1625
avoid using Date() function from javascript as it works on the regional settings of the local machine which may result different output on different machines.
Jan 22 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Ray | last post by:
Date problem. Using non American date formats with Microsoft Access and Visual Basic. I set my regional settings to English(Ireland) or English(United Kingdom) and my date appears in Access as...
2
by: monki | last post by:
hi i am working with uk date formats (dd/mm/yy) however the server the site is hosted on is in the us(mm/dd/yy) format i am using the following to convert the ddates gigdateuk =...
6
by: Suzanne | last post by:
Hi, I am having problems with my website which uses ASP. It is switching between American and European date formats - this is causing problems on the page which use the Date function. Most of...
1
by: OKI | last post by:
Hi. I had a VB program that was using an SQL Server 6.5 DB. Date format was dd/mm/yyyy. Now the DB was changed to an SQL Server 7 and the date format is yyyy/mm/dd. How can I do for changing...
4
by: Richard Hollenbeck | last post by:
I'm trying to write some code that will convert any of the most popular standard date formats twice in to something like "dd Mmm yyyy" (i.e. 08 Jan 1908) and compare the first with the second and...
1
by: Vilen | last post by:
Hi. I have a DB in which we store dates in yyyy/mm/dd. However when we want to display this date via a web frontend, it needs to be in dd/mm/yyyy. I've declared a function (shown below) which...
2
by: Yoshi | last post by:
Is there a way to programatilly obtain a list of all the data formats using C# code? Thanks, Dave
2
by: ABC | last post by:
Hi, All Which function return the desktop long and short date formats? Thanks
2
by: gstark | last post by:
Hi, I have a difference between machines in the date formats they produce. This one web application has this code. Me.txtRxDate.Text = Now().ToShortDateString. On the development server, the...
5
by: rammy | last post by:
I have a stored procedure that gets the date as input parameter. I have connected this stored proc to crystal report. When i run the report, for the date parameter, the crystal report is asking to...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.