arh, so when I get a field value, I should use for...
# suitescript
p
arh, so when I get a field value, I should use format.parse() on it?
b
dont
use Record.getValue(options) on a Date Time field to get a Date
use Record.getText(options) on a Date Time field to get a String representing the Date Time String
if you plan on manipulating the Date, you want to start with the Date
e
ah you're on about SS2.0... it's different in SS1.0 where getting the Value is the same as getting the Text.
p
im using result.getvalue, and that returns a string
thanks, ill use a record.load to get the value as an object
b
I think you do use format.parse if you are on a SearchResult that isn't using a string formula that define a custom date time stamp, though I have no experience there
n
format.parse should do your job of parsing the string to JS Date obj otherwise just use the JS Date constructor. Like just get var a = new Date(<your string date>);
p
it works with both result.getvalue(string) then format.parse(obj) and with record.load(obj). the new Date(string) is not well suited, as the 24h vs 12h clock is difficult to handle as I (in my use case) cant seem to handle am/pm very well, later in the script.
n
Well in that case, format.parse() it is. Hope you were able to resolve this.
p
thanks, I was
👍🏻 1