Reputation: 777
I am trying to take the difference between 2 custom fields that are dates in a saved search. Not sure why the result is not a number. {custrecord_shep_lease_end_date}-{custrecord_shep_lease_start_date} give me a date/time format and {lastmodified}-{created} give me a number. Any idea why?
Upvotes: 0
Views: 629
Reputation: 5231
Oracle has two main flavors of date data types: date and timestamp. When you perform a subtraction with a date, the result returned is a number indicating the difference in days. However, if you perform the same calculation on timestamps, you will get another, related, data type returned: interval.
NetSuite's documentation doesn't seem to cover what backend data types exactly match the exposed 'date' and 'datetime' fields shown in the UI, but my understanding is that custom fields of datetime type are timestamps in the database.
There are lots of wrinkles to arithmetic with timestamps/intervals and I don't have time to cover it all right now, but hopefully that will get you pointed in the right direction.
Upvotes: 1