Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. Time t = DateTime.now().Time();
  2. String s = JSON.serialize(t);
  3.  
  4. System.debug(s); // "13:50:40.848Z"
  5.  
  6. Time t2 = (Time)JSON.deserialize(s, Time.class);
  7.  
  8. System.debug(t2); // 13:50:40.848Z
  9.  
  10. Test__Test1__c test = new Test__Test1__c(
  11. Test__Time__c = DateTime.now().Time()
  12. );
  13.  
  14. String testString = JSON.serialize(test);
  15.  
  16. System.debug(testString);
  17.  
  18. Test__Test1__c result = (Test__Test1__c)JSON.deserialize(testString, Test__Test1__c.class);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement