Commit de2568e8 authored by Nigel Kukard's avatar Nigel Kukard
Browse files

Added date function

- Robert Anderson <randerson@lbsd.net>
parent 6455cb5f
......@@ -58,5 +58,32 @@ function formatUnixTimestamp(v,f) {
}
}
// Return unix time, or "", or " "
function form_DateToUnix(value) {
// Return nothing if we have no value
if (!value) {
return;
}
// Form values may be "" or " "
var res = value;
if (!(res == " " || res == "")) {
// Try and parse date
var dt = new Date.parseDate(res, 'Y-m-d H:i');
if (!dt) {
return;
}
// Convert to unix time
var dt_unix = dt.getTime() / 1000;
// Set result
res = dt_unix;
}
return res;
}
// vim: ts=4
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment