Craig
05/31/2022, 10:35 PMAzi
05/31/2022, 10:51 PMconst formattedDate = new Date(format.format({
type: format.Type.DATETIME,
value: new Date(),
timezone: format.Timezone.AMERICA_NEW_YORK
}))
newLogRecord.setValue('custrecord_log_date', formattedDate)
Azi
05/31/2022, 10:51 PMbattk
06/01/2022, 1:43 AMbattk
06/01/2022, 1:48 AMnew Date()
makes a Date representing the time right now (which will using Pacific time)
format.format({
type: format.Type.DATETIME,
value: new Date(),
timezone: format.Timezone.AMERICA_NEW_YORK
}))
makes a string representing a date time 3 hours in the future (since Eastern time is 3 hours ahead of Pacific)
new Date(format.format({
type: format.Type.DATETIME,
value: new Date(),
timezone: format.Timezone.AMERICA_NEW_YORK
}))
finally, the new Date constructor will attempt to make a Date 3 hours in the future
I use the word attempt since the Date constructor isn't good enough to work in different date formatsbattk
06/01/2022, 1:48 AMbattk
06/01/2022, 1:49 AMnewLogRecord.setValue('custrecord_log_date', new Date())
Azi
06/01/2022, 3:08 AMAzi
06/01/2022, 3:09 AMbattk
06/01/2022, 3:15 AMbattk
06/01/2022, 3:15 AMbattk
06/01/2022, 3:16 AMbattk
06/01/2022, 3:16 AMAzi
06/13/2022, 10:44 PMbattk
06/13/2022, 10:48 PMAzi
06/13/2022, 10:49 PMAzi
06/13/2022, 10:49 PMbattk
06/13/2022, 10:51 PMAzi
06/13/2022, 10:53 PMbattk
06/13/2022, 10:55 PMbattk
06/13/2022, 10:57 PM2022-06-13 22:55
it uses the current user's timezone to determine the unix timebattk
06/13/2022, 10:58 PMbattk
06/13/2022, 10:58 PMAzi
06/13/2022, 10:59 PMbattk
06/13/2022, 10:59 PMbattk
06/13/2022, 10:59 PMbattk
06/13/2022, 11:00 PMAzi
06/13/2022, 11:01 PMbattk
06/13/2022, 11:01 PMbattk
06/13/2022, 11:01 PMbattk
06/13/2022, 11:01 PMAzi
06/13/2022, 11:02 PMAzi
06/13/2022, 11:02 PMbattk
06/13/2022, 11:02 PMbattk
06/13/2022, 11:03 PMbattk
06/13/2022, 11:03 PMformat.format({
type: format.Type.DATETIME,
value: new Date(),
timezone: format.Timezone.AMERICA_NEW_YORK
}))
doesAzi
06/13/2022, 11:05 PMbattk
06/13/2022, 11:06 PMbattk
06/13/2022, 11:06 PMbattk
06/13/2022, 11:06 PM2022-06-13 22:55
battk
06/13/2022, 11:08 PMAzi
06/13/2022, 11:08 PMbattk
06/13/2022, 11:08 PMbattk
06/13/2022, 11:09 PMbattk
06/13/2022, 11:09 PMbattk
06/13/2022, 11:09 PMAzi
06/13/2022, 11:09 PMbattk
06/13/2022, 11:09 PMbattk
06/13/2022, 11:11 PMbattk
06/13/2022, 11:11 PMbattk
06/13/2022, 11:11 PMAzi
06/13/2022, 11:17 PMnewLogRecord.setValue('custrecord_the_date', new Date())
set the current date and time and then my company setting would adjust how it is displayed to me?battk
06/13/2022, 11:20 PMbattk
06/13/2022, 11:21 PMbattk
06/13/2022, 11:21 PMAzi
06/13/2022, 11:22 PMAzi
06/13/2022, 11:39 PM