function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
jcookejcooke 

Question - Date/Time formatting in Salesforce

Hi,  We have a automatic way of creating our custom object of Product setups through our opportunity record, which was custom developed.

 When this occurs a expiration date is automatically brought in from our opportunity contract end date.

 

I noticed that the time is always set to 12:00 AM ,but when I create a Product setup manually through the account record the expiration date  time field always shows the time is at this moment.

 

Is this a salesforce standard functionality that it would always default to 12:00 AM no matter what the date is? Or would this be somewhere in their triggers/apex class or code? I am trying to find anything written out, but having no luck so wanted to know if was standard practice.

 

I found one s-control code that said this?


'expirationDate="'+ expDate.format("yyyy-mm-dd HH:MM:ss")+'" '+

Thanks

Best Answer chosen by Admin (Salesforce Developers) 
Anand@SAASAnand@SAAS

If you are copying over a "Date" from Opportunity, it will default to 12am as Date type fields don't have a time associated with it. If you are copying from a "Datetime" field, the time should get carried over. 

All Answers

Anand@SAASAnand@SAAS

If you are copying over a "Date" from Opportunity, it will default to 12am as Date type fields don't have a time associated with it. If you are copying from a "Datetime" field, the time should get carried over. 

This was selected as the best answer
jcookejcooke

Thank you so much for your quick response.  I saw we do have a regular date field and it was set this way in our opportunity trigger, which cannot be changed


thx