vincentlowe

Three Date Formats (DWL)

Feb 15th, 2022
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. %dw 2.0
  2. output application/json
  3.  
  4. var someDates = [
  5. "Jun 11, 2018",
  6. "Sep 11, 2017",
  7. "Jul 11, 2018",
  8. "Sep 21, 2017",
  9. "2018-01-20T00:00:00",
  10. "2018-01-25T00:00:00",
  11. "2018-01-20T00:00:00",
  12. "2018/07/11",
  13. "2018/08/11"
  14. ]
  15.  
  16. type Scientific = String {format: "yyyy-MM-dd"}
  17. type USDate = String {format: "MMM dd, yyyy"}
  18. type WorldDate = String {format: "dd-MM-yyyy"}
  19. type Chosen = WorldDate
  20.  
  21. fun normalizeDate (d: String) = d
  22.  
  23. ---
  24. someDates map normalizeDate($)
Advertisement
Add Comment
Please, Sign In to add comment