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(...
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....
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/...
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 ...
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.
...
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 ...
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 +
...
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(...
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 ...
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(...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
date × 707apex × 253
datetime × 166
formula × 101
soql × 66
formula-field × 60
marketing-cloud × 57
visualforce × 50
lightning-web-components × 28
javascript × 25
ampscript × 24
formatting × 24
query × 21
lightning-aura-components × 20
workflow × 19
reporting × 17
trigger × 16
lightning × 16
time × 16
visual-workflow × 15
timezone × 15
format × 15
field-update × 14
opportunity × 13
sql × 13