- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2017 04:33 AM
Try changing "(dur_seconds / 60 / 60)" to "(dur_seconds / 3600)"
Also, if you're doing "Math.round()" then .66 rounded = 1.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2017 05:09 AM
Hi Dave,
Yes , "Math.round()" then .66 rounded = 1.
Which function should I used to get value decimal format that .66 form.
Thanks,
Sourabh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2017 06:16 AM
Hi Sourabh
Do you need a specific number of decimals? Otherwise you can just remove the "Math.round()" function.
var dur_seconds = 2400;
var dur_hours = dur_seconds / 3600;
gs.print(dur_hours); // *** Script: 0.6666666666666666
The example above is updated.
Best regards
Markus
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2017 06:47 AM
Possibly parseFloat() - check the Javascript documentation for the Math and Number classes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2018 08:41 PM