Skip to main content
5 votes
Accepted

How to find first Monday from given date?

The primary reason for that is that your formula is currently, literally being told to start from the first of the month /* v This right here */ DATE(...
Derek F's user avatar
  • 63.2k
5 votes
Accepted

How to write a formula to match a month prior to today's date with a date field on the contact

All of the details of handling dates (and there are a lot more details than most people realize) are handled automatically when using ADDMONTHS() and also when adding/subtracting a number of days, e.g....
Derek F's user avatar
  • 63.2k
3 votes
Accepted

Inserting a date field with soap API

JSON doesn't have a "native" date type. It has to be a string with quotes around it. Never write your own JSON, as it's easy to get wrong. I recommend using at minimum a combination of Map/...
sfdcfox's user avatar
  • 500k
2 votes

How to determine start of week for a given locale in Apex

This isn't a solution to getting the start of day for any locale real time. It's a work around. I've written some ad-hoc code to get the start of week for each locale. From that, I can hard-code a ...
Ken's user avatar
  • 488
2 votes
Accepted

Format Date field to pass to OmniScript

Short answer: You need to cast it as a DateTime object, otherwise you won't be able to use the format(dateFormatString) method. The TestDate__c field used in the following example is a Date field. ...
DevelBase2's user avatar
2 votes

Change date format like dd/mm/yy

That's a valid date format. You don't need any processing converting to strings, splitting or anything. You can directly use Date.prototype.toLocaleString(). The format you need is actually India's ...
Sachin Hooda's user avatar
  • 1,642
1 vote
Accepted

How to make a formula with correct difference between dates in months?

You can use a more precise method by calculating the number of days and then dividing by the average number of days per month. ROUND( ((YEAR(EndDate__c) - YEAR(EffectiveDate__c)) * 12 + ...
Tushar Jadav's user avatar
  • 2,745
1 vote

Help with date formula

Below is a Formula you can use: IF( TODAY() > DATE(YEAR(TODAY()), MONTH(Contract_Start_Date__c), DAY(Contract_Start_Date__c)), DATE(YEAR(TODAY()) + 1, MONTH(Contract_Start_Date__c), DAY(...
Tushar Jadav's user avatar
  • 2,745
1 vote

Update EndDate by calculating through start date +duration(picklist field)

Assuming that your updateWarrantyRecords() method is being called in a trigger context (from a trigger, from a handler in a trigger framework, etc...) Then I believe the main issue is the following ...
Derek F's user avatar
  • 63.2k
1 vote
Accepted

Method does not exist or incorrect signature: void date() from the type Date

Apex has two shortcuts, an overloaded + and - operator: sc.Cancellation_Request_Date__c = sc.Next_Payment_Date__c - 1; // Subtract a day Further, a Date is already a Date, which is why it has no date(...
sfdcfox's user avatar
  • 500k

Only top scored, non community-wiki answers of a minimum length are eligible