Guest User

Untitled

a guest
Nov 19th, 2019
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. const Date = packed struct {
  2. year: i32,
  3. month: u8,
  4. day: u8,
  5. hour: u8,
  6. minute: u8,
  7. nanosecond: u64,
  8. timezone: [3]u8 = "UTC",
  9.  
  10. fn parse(input: []const u8, comptime format: []const u8) Date {
  11. return Date{
  12. .year = 2018,
  13. .month = 3,
  14. .day = 5,
  15. .hour = 0,
  16. .minute = 0,
  17. .nanosecond = 0,
  18. };
  19. }
  20. };
  21.  
  22. test "parsing" {
  23. const input = "2018-03-05 00:00:00";
  24. const date = Date.parse(input, "YYYY-MM-DD hh:mm:ss");
  25. }
Advertisement
Add Comment
Please, Sign In to add comment