Skip to content

Instantly share code, notes, and snippets.

View Shibily-kms's full-sized avatar
:electron:

SHIBILY MUHAMMED Shibily-kms

:electron:
View GitHub Profile
@Shibily-kms
Shibily-kms / date_and_time_formats.js
Last active September 11, 2023 09:30
JS Date Time Formats
// ISO time to YYYYMMDD formate using JavaScript
const YYYYMMDDFormat = (ISOdate, symbol = '-') => {
symbol = symbol ? symbol : ''
const year = ISOdate.getFullYear();
const month = String(ISOdate.getMonth() + 1).padStart(2, '0');
const day = String(ISOdate.getDate()).padStart(2, '0');
return `${year}${symbol}${month}${symbol}${day}`;
}
@Shibily-kms
Shibily-kms / amount-in-word.js
Created October 16, 2023 10:21
Amount write in word
const numberInWord = (amount) => {
const units = ['', 'One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine'];
const teens = ['', 'Eleven', 'Twelve', 'Thirteen', 'Fourteen', 'Fifteen', 'Sixteen', 'Seventeen', 'Eighteen', 'Nineteen'];
const tens = ['', 'Ten', 'Twenty', 'Thirty', 'Forty', 'Fifty', 'Sixty', 'Seventy', 'Eighty', 'Ninety'];
const thousands = ['', 'Thousand', 'Million', 'Billion', 'Trillion']; // Extend as needed
function convertThreeDigits(num) {
const numStr = num.toString();
const [a, b, c] = numStr.padStart(3, '0').split('').map(Number);