+ some date and distance formatting functions
authortgambet
Fri, 26 Aug 2011 12:44:21 -0400
changeset 115 4ff9d9b168d0
parent 114 ad61999e74bf
child 116 62a6ef3e6702
+ some date and distance formatting functions
src/main/resources/scripts/Utils.js
--- a/src/main/resources/scripts/Utils.js	Fri Aug 26 12:43:51 2011 -0400
+++ b/src/main/resources/scripts/Utils.js	Fri Aug 26 12:44:21 2011 -0400
@@ -66,6 +66,20 @@
     seconds = t - ((hours * 3600) + (minutes * 60));
     return ((hours > 0)?  Util.formatNumber(hours) + ":": "") + Util.formatNumber(minutes) + ":" + Util.formatNumber(seconds);
   },
+  
+  formatTime2 : function (timestamp) {
+  	date = new Date(timestamp);
+  	return date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();
+  },
+  
+  formatDate : function (timestamp) {
+  	date = new Date(timestamp);
+  	return (parseInt(date.getMonth()) + 1).toString() + '/' + date.getDate() + '/' + date.getFullYear();
+  },
+  
+  formatDistance : function (meters) {
+  	return Math.round(meters/10)/100 + ' km';
+  },
 
 
   // Geolocation related functions