From 824a2d9f587ca017fc71b84d835e72f54f9c87c4 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Wed, 7 Nov 2018 18:02:36 +0100 Subject: Began rewrite --- node_modules/locutus/php/datetime/gmdate.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 node_modules/locutus/php/datetime/gmdate.js (limited to 'node_modules/locutus/php/datetime/gmdate.js') diff --git a/node_modules/locutus/php/datetime/gmdate.js b/node_modules/locutus/php/datetime/gmdate.js new file mode 100644 index 0000000..5910ac2 --- /dev/null +++ b/node_modules/locutus/php/datetime/gmdate.js @@ -0,0 +1,21 @@ +'use strict'; + +module.exports = function gmdate(format, timestamp) { + // discuss at: http://locutus.io/php/gmdate/ + // original by: Brett Zamir (http://brett-zamir.me) + // input by: Alex + // bugfixed by: Brett Zamir (http://brett-zamir.me) + // example 1: gmdate('H:m:s \\m \\i\\s \\m\\o\\n\\t\\h', 1062402400); // Return will depend on your timezone + // returns 1: '07:09:40 m is month' + + var date = require('../datetime/date'); + + var dt = typeof timestamp === 'undefined' ? new Date() // Not provided + : timestamp instanceof Date ? new Date(timestamp) // Javascript Date() + : new Date(timestamp * 1000); // UNIX timestamp (auto-convert to int) + + timestamp = Date.parse(dt.toUTCString().slice(0, -4)) / 1000; + + return date(format, timestamp); +}; +//# sourceMappingURL=gmdate.js.map \ No newline at end of file -- cgit v1.2.3