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
Varun YagainVarun Yagain 

Changing current time as returned by System.Now()

With our application developed on the Force.com platform, we have a need to modify the current time as returned by System.Now() in order to simulate scenarious at various epochs. 

 

Could someone point me to related documentation/help/discussion if there anyway to achieve that?

 

Thanks in advance,

Varun.

NasipuriNasipuri

Hi Varun,

 

Salesforce.com is a multitenant

platform , So in a single infrastructure SFDC runs not only your ORG but also thousands of other ORGs used by other user.

 

So Salesforce.com don't allow to modify it's system time , you will not be able to change the value of System.now() . You need to find some other way of testing.

 

Thanks and Regards,

Dinesh Nasipuri

Dinesh.Nasipuri@gmail.com

Navatar_DbSupNavatar_DbSup

Hi,

 

You can modify the date time return by system.now() function by using the various method,

 

For more detail follow the below link:

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_datetime.htm

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

 

Varun YagainVarun Yagain

Hello S Jain,

 

Thank you for the response. I'm afraid changing the application logic for testing as suggested by your solution is not what I am looking for. I need to change the environment to create different epochs.

 

- Varun.

Edwin VijayEdwin Vijay

Hello, 

 

Could you elaborate on your scenario pls? Would be good if you could let us know the use- case and what you are trying to accomplish