close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

change time zone in time field sent by form

Thread began 8/08/2011 9:47 am by ptp158834 | Last modified 8/09/2011 6:40 pm by ptp158834 | 2627 views | 6 replies

ptp158834

change time zone in time field sent by form

How can I change the time from PDT to GMT.
The following code in SpryValidationTextField.js seems to handle the time, any help would be appreciated.
Thanks
Peter

'time': {
validation: function(value, options) {
// HH:MM:SS T
var formatRegExp = /([hmst]+)/gi;
var valueRegExp = /(\d+|AM?|PM?)/gi;
var formatGroups = options.format.match(formatRegExp);
var valueGroups = value.match(valueRegExp);
//mast match and have same length
if (formatGroups !== null && valueGroups !== null) {
if (formatGroups.length != valueGroups.length) {
return false;
}

var hourIndex = -1;
var minuteIndex = -1;
var secondIndex = -1;
//T is AM or PM
var tIndex = -1;
var theHour = 0, theMinute = 0, theSecond = 0, theT = 'AM';
for (var i=0; i<formatGroups.length; i++) {
switch (formatGroups[i].toLowerCase()) {
case "hh":
hourIndex = i;
break;
case "mm":
minuteIndex = i;
break;
case "ss":
secondIndex = i;
break;
case "t":
case "tt":
tIndex = i;
break;
}
}
if (hourIndex != -1) {
var theHour = parseInt(valueGroups[hourIndex], 10);
if (isNaN(theHour) || theHour > (formatGroups[hourIndex] == 'HH' ? 23 : 12 )) {
return false;
}
}
if (minuteIndex != -1) {
var theMinute = parseInt(valueGroups[minuteIndex], 10);
if (isNaN(theMinute) || theMinute > 59) {
return false;
}
}
if (secondIndex != -1) {
var theSecond = parseInt(valueGroups[secondIndex], 10);
if (isNaN(theSecond) || theSecond > 59) {
return false;
}
}
if (tIndex != -1) {
var theT = valueGroups[tIndex].toUpperCase();
if (
formatGroups[tIndex].toUpperCase() == 'TT' && !/^a|pm$/i.test(theT) ||
formatGroups[tIndex].toUpperCase() == 'T' && !/^a|p$/i.test(theT)
) {
return false;
}
}
var date = new Date(2000, 0, 1, theHour + (theT.charAt(0) == 'P'?12:0), theMinute, theSecond);
return date;
} else {
return false;
}
}

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...