You need to sign in to do that
Don't have an account?
Aidan Peoples
How to get two digit day from a date formula e.g. 1st should be 01 2nd should be 02
Hi,
I have created a formula in a work flow to concatenate several fields to for a new field in opportunities, this works however for the date, I would like the day to show as two digits for day 1-9 in the month but I cannot seem to figure out how to update my formula (below) to manage this. The result I am looking to achieve is where a call date is 09/09/2017 should be returned as 09SEP17.
Thanks in advance
Aidan
Product2.ProductCode + '-' + Opportunity.Port__r.Port_Code__c + '-' + Opportunity.Ship__r.Code__c + '-' +
TEXT(DAY(Opportunity.Call_Date__c)) + CASE(MONTH(Opportunity.Call_Date__c),
1, "JAN",
2, "FEB",
3, "MAR",
4, "APR",
5, "MAY",
6, "JUN",
7, "JUL",
8, "AUG",
9, "SEP",
10, "OCT",
11, "NOV",
12, "DEC",
"None") + RIGHT(TEXT(YEAR(Opportunity.Call_Date__c)),2)
I have created a formula in a work flow to concatenate several fields to for a new field in opportunities, this works however for the date, I would like the day to show as two digits for day 1-9 in the month but I cannot seem to figure out how to update my formula (below) to manage this. The result I am looking to achieve is where a call date is 09/09/2017 should be returned as 09SEP17.
Thanks in advance
Aidan
Product2.ProductCode + '-' + Opportunity.Port__r.Port_Code__c + '-' + Opportunity.Ship__r.Code__c + '-' +
TEXT(DAY(Opportunity.Call_Date__c)) + CASE(MONTH(Opportunity.Call_Date__c),
1, "JAN",
2, "FEB",
3, "MAR",
4, "APR",
5, "MAY",
6, "JUN",
7, "JUL",
8, "AUG",
9, "SEP",
10, "OCT",
11, "NOV",
12, "DEC",
"None") + RIGHT(TEXT(YEAR(Opportunity.Call_Date__c)),2)
In the updated formula, the RIGHT("0" + TEXT(DAY(Opportunity.Call_Date__c)), 2) expression is responsible for ensuring the day is represented with two digits. It adds a leading zero (using the concatenation operator "+") to the day value and then extracts the rightmost two characters, effectively resulting in a two-digit day.azure developer course (https://www.igmguru.com/cloud-computing/microsoft-azure-developer-az-203-certification-training/)
With this modification, the formula should return the desired result, such as "09SEP17" for a call date of 09/09/2017.
javascriptCopy code
TEXT(DAY(Date_Field), "00") & TEXT(Date_Field, "MMMYY")
This should help you display the day in a two-digit format (e.g., 09SEP17) regardless of whether it's a single-digit or double-digit day.