Dependent values in formula validation in salesforce
1 ) IF(ISBLANK(FieldA__c),0,1)+IF(ISBLANK(FieldB__c),0,1)=1
Date format in Formula field and Apex in Salesforce
Format YYYY/MM/DD in formula field
TEXT(YEAR(DATEVALUE(Date__c) ))+ "/" +TEXT(MONTH(DATEVALUE(Date__c) ))+ "/" +TEXT(DAY(DATEVALUE(Date__c)))
Format MM/DD/YYYY in formula field
TEXT(MONTH(Date__c))+ "/" + TEXT(DAY(Date__c))+ "/" + TEXT(YEAR(Date__c))
Format DD/MM/YYYY in formula field
TEXT(DAY(Date__c))+ "/" +TEXT(MONTH(Date__c))+ "/" +TEXT(YEAR(Date__c))
Convert to String in APEX
Date myDate = Date.today();
String newFormat = myDate.year() + '/' + myDate.month() + '/' + myDate.day();
Convert using format() in APEX
DateTime dt = DateTime.now();
String newFormat = dt.format('yyyy/MM/dd hh:mm:ss');
Formula to Validate PAN and GST Number in Salesforce
IF(OR(
PAN_No__c == NULL, GST_No__c == NULL,
NOT( REGEX( PAN_No__c , "[A-Za-z]{5}[0-9]{4}[A-z]{1}") ),
NOT(REGEX(GST_No__c,"^([0][1-9]|[1-2][0-9]|[3][0-7])([a-zA-Z]{5}[0-9]{4}[a-zA-Z]{1}[1-9a-zA-Z]{1}[zZ]{1}[0-9a-zA-Z]{1})+$")), MID(GST_No__c,3,10) != PAN_No__c
)
,TRUE,FALSE
)