I have a table I’m searching using Servoy. The column is an integer that holds the epoch value equivalent of the createDate.
What I’m trying to do is search against this column, using a lastDate from another column in my solution. The lastDate is a date field.
So, I’m using lastDate.getTime()
It returns 1.240206315E9
But the values in createDate resemble something like 1240203998.
So, my search fails because I’m trying to search for any records with a createDate created after the lastDate.
Obviously, the difference in the formatting of the values renders my search a complete failure. Why doesn’t .getTime() return the value in an unscientific format? Why am I not technically talented enough to know this stuff?
I’m pretty sure you’ll find a lot of posts on the Forum about Javascript dates & searching - this old snippet of code has served me well and should get you started,
var startdate = globals.ctf_CreatedDate
startdate.setHours(00)
startdate.setMinutes(00)
startdate.setSeconds(00)
var thestart = utils.dateFormat(startdate, 'MM-dd-yyyy HH:mm:ss')
var enddate = new Date()
enddate.setHours(23)
enddate.setMinutes(59)
enddate.setSeconds(59)
var theend = utils.dateFormat(enddate, 'MM-dd-yyyy HH:mm:ss')
controller.find()
createddate = thestart + '...' + theend+ '|MM-dd-yyyy HH:mm:ss';
controller.search();
In this case, I’m searching against a integer. So I’m needing to convert my search date to it’s unix epoch but the value returned seems to be it’s scientific format. (see original post)