close ad
WARNING PC USERS: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

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 | 2503 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;
}
}

Sign in to reply to this post

Jason ByrnesWebAssist

I dont quite follow what you are trying to accomplish, are you trying to change the time that is displayed in an email?


can you send a screen shot showing what it is you are trying to change.

Sign in to reply to this post

ptp158834

Hi Jason,
yes I am trying to change the time that is displayed in an email to show GMT time - see attached.
Thanks
peter

Sign in to reply to this post

Jason ByrnesWebAssist

In the email template file, the code that generates the time in the email is:

php:
<?php $now time(); ?><?php echo date("n-j-Y"$now); ?>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<?php echo date("g:i A T"$now); ?>




change that code to:

php:
<?php date_default_timezone_set ("Europe/London"); $now time(); ?><?php echo date("n-j-Y"$now); ?>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<?php echo date("g:i A T"$now); ?>



to change the time zone.

Sign in to reply to this post

ptp158834

Hi Jason,
I got this error message when I changed the code.
Fatal error: Call to undefined function: date_default_timezone_set() in /home/9/2/f/2603/2603/public_html/webassist/email/templates/Blank_8.php on line 34
any ideas?
Peter

Sign in to reply to this post

Jason ByrnesWebAssist

what version of PHP is your host running? if you can, have them update the php version to php 5.

Sign in to reply to this post

ptp158834

Thanks PHP updated to Version 5

Sign in to reply to this post

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...