User Story
Create a program which debugs the day you born
Year and Month must be dynamic.
Expected Outcome
Wednesday
Code
Specific Date
Datetime myDOB = Datetime.NewInstance(1983,3,2);
String dayofMyDob = myDOB.format('EEEE');
System.debug(dayofMyDob);
Year and Month Dynamic
Integer y =1983;
Integer m =3;
Integer d =2;
Datetime myDOB = Datetime.NewInstance(y,m,d);
String dayofMyDob = myDOB.format('EEEE');
System.debug(dayofMyDob);
In a Class as a Method
public class UsefulApexCodes {
public static void BasicApex15(Integer y, Integer m, Integer d){
Datetime myDOB = Datetime.NewInstance(y,m,d);
String dayofMyDob = myDOB.format('EEEE');
System.debug(dayofMyDob);
}
}
Test Class
@isTest
public class UsefulApexCodesTest {
@isTest
static void testBasicApex15() {
// Test with a known date of birth
Integer y = 2000;
Integer m = 1;
Integer d = 1;
UsefulApexCodes.BasicApex15(y, m, d);
}
}
Video
Video does not exists.