Skip to main content

Posts

Showing posts from September, 2022

Formatting the new time field of Salesforce in Visualforce Page

The Time class in Salesforce is very limited, especially compared to the DateTime class. It doesn't even have its own format method, which I think may be the underlying problem here. Without a format method to accept the formatting string, Salesforce might not be able to properly format the field. So I have created a method which will convert the time in AM/PM and it will show on the vf page as it is formatted. public String formatedTime(Time timeValue){         String hh;         String mm;         String ampm;         if(timeValue != null){             if(timeValue.hour() <= 12){                 if(timeValue.hour() == 0){                     hh = String.valueOf(timeValue.hour() + 12);                 }else{           ...