Skip to content

Instantly share code, notes, and snippets.

@mxschmitt
Last active May 11, 2018 07:55
Show Gist options
  • Save mxschmitt/cf4f1b75e107019d82788985b72e1daf to your computer and use it in GitHub Desktop.
Save mxschmitt/cf4f1b75e107019d82788985b72e1daf to your computer and use it in GitHub Desktop.
Format ABAP like timestamp in JavaScript
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