Forum Discussion
itsjustchuckits
9 years agoQrew Trainee
Dan I'm trying to perform a calculation with a date field and the value I have stored is 5/26/2016 on the record. The API returns 1464220800000. The app setting is set to EST. I take this value and create a date with it and pass it to a function AddBusinessDays(d,n) d = date | n = # of days to add
if you do $.datepicker.formatDate("mm/dd/yy", new Date( parseInt("1464220800000" ,10)) ); for me my console returns 5/25/16 at 8pm applying -4 hours for EST. so this date is whats being passed into the AddBusinessDays and that function does d = new Date(d.getTime()); which returns 1464148800000. The timezone is getting applied twice. I find coding with dates really confusing for some reason. Any suggestions would be greatly appreciated!
if you do $.datepicker.formatDate("mm/dd/yy", new Date( parseInt("1464220800000" ,10)) ); for me my console returns 5/25/16 at 8pm applying -4 hours for EST. so this date is whats being passed into the AddBusinessDays and that function does d = new Date(d.getTime()); which returns 1464148800000. The timezone is getting applied twice. I find coding with dates really confusing for some reason. Any suggestions would be greatly appreciated!