Adding time to date
Hi, I'm importing a field with a weird date format and have been able to pull out all the parts using index &sub string commands but when I try to convert to a date, I can't figure out how to ensure the time is also included. The date function will not include time so anyone who has had experience of this, your advice would be greatly appreciated!
this is the native, imported date format : 2019, December 30, 11:01
thanks again, this forum is invaluable for us newbies!
1 reply
-
You would use the
datetime()
function instead of thedate()
function. I've been learning Regex and Ninox has some Regex functions that allow you to parse text values. Here's what I came up with for your example...let dateRegex := "(\d{4}), (\w+) (\d{1,2}), (\d{1,2}):(\d{1,2})";
let myYear := number(extractx(myDate, dateRegex, "$1"));
let myMonth := monthIndex(extractx(myDate, dateRegex, "$2"));
let myDay := number(extractx(myDate, dateRegex, "$3"));
let myMinutes := number(extractx(myDate, dateRegex, "$4"));
let mySeconds := number(extractx(myDate, dateRegex, "$5"));
datetime(myYear, myMonth, myDay, myMinutes, mySeconds)
Content aside
- 5 yrs agoLast active
- 1Replies
- 1331Views