Last active
May 11, 2018 07:55
-
-
Save mxschmitt/cf4f1b75e107019d82788985b72e1daf to your computer and use it in GitHub Desktop.
Format ABAP like timestamp in JavaScript
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
Date.prototype.toABAPString = function () { | |
let formatNumber = number => ("0" + number).slice(-2); | |
return this.getFullYear() + formatNumber(this.getUTCMonth() + 1) + formatNumber(this.getUTCDate()) + formatNumber(this.getUTCHours()) + formatNumber(this.getUTCMinutes()) + formatNumber(this.getSeconds()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment