Multiple Data Formats

87 views
Skip to first unread message

John W

unread,
Apr 17, 2014, 12:35:50 PM4/17/14
to forme...@googlegroups.com

 
All....
First off I use your FormEmailer ALL the time and love it.  I have a question for you though.  I have a form that Ask for a Date in one question and then a Time in another question on the same form.  When you send the email using formemailer for both questions it puts the Long Date and Time on the emailer.   Now with that it messes up the time frame because it puts an 1869 date and year.
I have found in the script the var ddf for the format and can change it to where it only puts the proper month, date, year but then for a Time it doesn't put the time it only list the Year.

Originally looks....
Type of Leave Requested: Sick
Start Date: 4/24/2014 0:00:00
End Date: 4/24/2014 0:00:00
Start Time: 12/30/1899 8:00:00
End Time: 12/30/1899 12:00:00

Way it currently looks.....
Type of Leave Requested: Other
Start Date: 4/28/2014
End Date: 4/28/2014
Start Time: 12/30/1899
End Time: 12/30/1899

Is there a way to fix it to where it will have the Times properly showing for 2 different ways???

Any help is greatly appreciated!!

Henrique Abreu

unread,
Apr 17, 2014, 1:32:07 PM4/17/14
to FormEmailer on behalf of John W
Hi John,

Yes, there's no need to change the code to do that. It's a built-in feature. Please read here:

This 1869 thing is just how dates work in spreadsheets. There's no pure Time value, it's always a date, it's just formatted differently to hide this 1869 date from you. If you run any date function referencing this cell you'll see what it actually is. Since we're on the topic, it's important to notice that dates are actually just numbers with a different formatting. In spreadsheets the underlying number value of a date is the number of days since the epoch (1/1/1970 00:00 GMT) and the hours are decimals.

Using FormEmailer formatting feature you can achieve the same thing you have on the spreadsheet, which is to hide the date part from your "datetime" cell.

Regards,

Henrique Abreu


--
You received this message because you are subscribed to the Google Groups "FormEmailer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to formemailer...@googlegroups.com.
To post to this group, send email to forme...@googlegroups.com.
Visit this group at http://groups.google.com/group/formemailer.
For more options, visit https://groups.google.com/d/optout.

Nick

unread,
Dec 31, 2014, 6:22:07 AM12/31/14
to forme...@googlegroups.com
Could anyone provide an example of the correct code?  I've reviewed the page linked and can't see how to apply it.  The code for creating the email is:

function createDefaultEmail_(idx) {
 
var email = 'us...@example.com';
 
try { email = Session.getEffectiveUser().getEmail(); } catch(suppress) {}
 
var body = T.defaultBody+'<br>\n<b>'+c.questions[0]+': </b>#'+c.questions[0]+'|d/M/yyyy H:mm:ss#<br>\n';
 
for( var i = 1; i < c.questions.length; i++ )
    body
+= '<b>'+c.questions[i]+': </b>#'+c.questions[i]+'#<br>\n';
       
//sender,replyTo,   to,        cc,bcc, subject,          body, html
 
var v = [NAME, '', email, '', '', T.defaultSubject, body, 'true'];
 
for( var i in ef )
    s
[ef[i]+idx] = v[i];
}

but I can't see how to change the format for one question but not for another.  I have two questions, one with an answer that should be formatted d/M/yyyy and another that should be formatted H:mm.


On Thursday, 17 April 2014 18:32:07 UTC+1, Henrique Abreu wrote:
Hi John,

Yes, there's no need to change the code to do that. It's a built-in feature. Please read here:

This 1869 thing is just how dates work in spreadsheets. There's no pure Time value, it's always a date, it's just formatted differently to hide this 1869 date from you. If you run any date function referencing this cell you'll see what it actually is. Since we're on the topic, it's important to notice that dates are actually just numbers with a different formatting. In spreadsheets the underlying number value of a date is the number of days since the epoch (1/1/1970 00:00 GMT) and the hours are decimals.

Using FormEmailer formatting feature you can achieve the same thing you have on the spreadsheet, which is to hide the date part from your "datetime" cell.

Regards,

Henrique Abreu

Henrique Abreu

unread,
Mar 28, 2015, 4:53:47 PM3/28/15
to FormEmailer on behalf of Nick
Are you still having trouble with this?

Again, there's no need to change the code.

Henrique Abreu
Reply all
Reply to author
Forward
0 new messages