function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SidViciousSidVicious 

Json to Apex Helper class

Hi Developers,

I'm using a simple helper parser class to help deserialize my json string. I wanted to convert UsedDate from Long type to DateTime type, but can't figure out how to do it within this class.

Please help, thank you.
 
public class Code {

    public String Code;
	public String Status;
	public Long UsedDate; // how to convert to DateTime

	public static List<Code> parse(String json) {
		return (List<Code>) System.JSON.deserialize(json, List<Code>.class);
	}
}
AnkaiahAnkaiah (Salesforce Developers) 
Hi Sid,

Please refer the below link will help you to proceed further.

https://stackoverflow.com/questions/11773369/convert-from-long-to-date-format

Thanks,
Ankaiah