Last active
December 5, 2022 18:55
-
-
Save Remonhasan/7c972131d24be5052027c2afe532d61d to your computer and use it in GitHub Desktop.
JavaScript Functions Handbook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get Current Date and Time | |
const current = new Date(); | |
const year = current.getFullYear(); | |
const day = String(current.getDate()).padStart(2, '0'); | |
const month = String(current.getMonth() + 1).padStart(2, '0'); | |
const time = + current.getHours() + ":" + current.getMinutes() + ":" + current.getSeconds(); | |
const currentDateTime = `${year}-${month}-${day} ${time}`; | |
const covertCurrentDateTime = DateTimeUtils.formatTimestamp(currentDateTime); | |
// Convert Time for Zoom Meeting | |
function timeConvert(n) { | |
var num = n; | |
var hours = (num / 60); | |
var rhours = Math.floor(hours); | |
var minutes = (hours - rhours) * 60; | |
var rminutes = Math.round(minutes); | |
return rhours + "." + rminutes; | |
} | |
timeConvert(120); | |
// Seperate Only Time | |
function separateTime(n) { | |
var now = new Date(n) | |
var time = now.toLocaleTimeString(); | |
return time; | |
} | |
// Translate English Number to Bangla | |
const toBn = n => n.toString().replace(/\d/g, d => "০১২৩৪৫৬৭৮৯"[d]) | |
// Date time Ul | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment