1
00:00:08,020 --> 00:00:09,680
Hey I'm back.

2
00:00:10,090 --> 00:00:15,760
Yeah I forgot something that is kind of important to teach you guys that I said I was going to if you

3
00:00:15,760 --> 00:00:22,810
remember when we were going through our our message cell we talked about the time stamp and that I was

4
00:00:22,810 --> 00:00:23,780
going to get back to it.

5
00:00:23,980 --> 00:00:25,430
And then I forgot to.

6
00:00:25,750 --> 00:00:27,480
So yeah we're going to go over that right now.

7
00:00:27,520 --> 00:00:34,330
So strap in we're going to talk about some ISO 86 or one dates.

8
00:00:34,330 --> 00:00:35,450
All right.

9
00:00:35,950 --> 00:00:44,600
So the format that the server gives the spec for dates is in the format called ISO 6 or 1.

10
00:00:44,920 --> 00:00:49,210
And so it's an international standard you can do some googling on it.

11
00:00:49,510 --> 00:00:51,850
But basically this is how it comes back.

12
00:00:51,850 --> 00:00:53,330
We have.

13
00:00:53,770 --> 00:00:55,080
I mean it's kind of recognizable.

14
00:00:55,070 --> 00:01:00,040
Here's your standard year month and day.

15
00:01:00,670 --> 00:01:06,540
Then we get into the hours minutes seconds and milliseconds.

16
00:01:07,090 --> 00:01:14,590
So this wouldn't be so bad to work with because Apple actually has a built in I assume 86 or one date

17
00:01:14,610 --> 00:01:22,840
for matter but the problem is the builtin one doesn't play well with milliseconds.

18
00:01:22,840 --> 00:01:28,330
So if we had just been given this right here then it be no problem we'd be able to convert this string

19
00:01:28,330 --> 00:01:34,390
into an ISO 86 or 1 date and then convert that directly to a date format that we're that we want to

20
00:01:34,390 --> 00:01:34,990
use.

21
00:01:35,140 --> 00:01:39,220
But because we have the Millicent's on here we're going to have to do a little bit of niggling with

22
00:01:39,220 --> 00:01:44,310
the string chopping off the end and then reopening the Z.

23
00:01:44,620 --> 00:01:48,900
So you know that's that's just just what we got to do so let's do it.

24
00:01:49,300 --> 00:01:57,910
First thing we're doing we're going to unwrap our our data I'm going to say guard let ISO date equal

25
00:01:57,910 --> 00:02:09,010
the message that time Stamm else we're going to return and then we're going to say we're going to do

26
00:02:09,010 --> 00:02:14,920
is we want to turn this string into this string.

27
00:02:14,930 --> 00:02:21,800
So we want to chop off these last five parts of the parts of the string OK.

28
00:02:22,020 --> 00:02:29,080
So we're going to we're going to define we're going to use a function called substring to and basically

29
00:02:29,080 --> 00:02:34,650
saying it'll take a string up to a specified index.

30
00:02:34,810 --> 00:02:37,370
So we need to tell it where to stop.

31
00:02:37,420 --> 00:02:45,490
So we're going to do that by saying that and equal ISO date dot index and to pick this one right here

32
00:02:45,490 --> 00:02:49,810
which returns it indicates that a specified distance from the given index.

33
00:02:49,950 --> 00:02:58,510
So the we're going to start at the end so I'm going to say I so take dot and index so we're saying start

34
00:02:58,510 --> 00:03:05,400
here and then offset by 5 which in the Bakra start can sum minus 5.

35
00:03:05,830 --> 00:03:08,850
So start at the end and then backtrack 5.

36
00:03:08,860 --> 00:03:13,860
And now this right here is your index.

37
00:03:13,990 --> 00:03:25,310
All right and then we're going to say ISO date is equal to ISO date dot substring up to and the end.

38
00:03:25,960 --> 00:03:32,130
So now this guy is this right here.

39
00:03:32,290 --> 00:03:36,210
We got rid of those last five by using substring to end.

40
00:03:36,220 --> 00:03:36,810
All right.

41
00:03:37,090 --> 00:03:46,380
So now we have a ISO 86 or one date format that is compatible with Apple's builtin formatter.

42
00:03:46,480 --> 00:03:52,270
So now we can say let ISO four matter equal I guess.

43
00:03:52,300 --> 00:03:55,420
Oh 86 so on do it formatter.

44
00:03:56,380 --> 00:04:09,700
And we're going to change our string into an ISO 86 or one date and say let chapt date equal to ISO

45
00:04:12,640 --> 00:04:19,980
formatter that date from string and the string is ISO date.

46
00:04:20,740 --> 00:04:29,290
But we also need we have to have that Z on the ends and C ISO date dot appending a string and that string

47
00:04:29,290 --> 00:04:32,220
is just the letter Z.

48
00:04:32,340 --> 00:04:33,000
OK.

49
00:04:33,550 --> 00:04:39,660
So basically through all of this we've turned this string into that string.

50
00:04:40,000 --> 00:04:43,610
And that is something that we can use with this formatter.

51
00:04:43,750 --> 00:04:48,490
So now we have an ISO 86 of one date not a string but an actual date.

52
00:04:48,760 --> 00:04:54,920
And we can use another date formatted to turn that into something more readable for us.

53
00:04:55,060 --> 00:04:56,790
OK so I say let.

54
00:04:56,880 --> 00:05:09,810
New format for equal date formatter and I can say new form letter that date format.

55
00:05:09,820 --> 00:05:14,470
And now we can customize how we want our dates to look.

56
00:05:14,900 --> 00:05:17,780
And so what we're going to do is we're going to say m m m.

57
00:05:17,830 --> 00:05:22,330
So this is going to give us the abbreviated month format.

58
00:05:22,470 --> 00:05:30,780
I'm going to say for the day that we're going to get us the hour the minute and then the AM or PM.

59
00:05:31,000 --> 00:05:31,710
All right.

60
00:05:32,070 --> 00:05:34,790
So that's our that's what our formatters is going to spit us out.

61
00:05:35,020 --> 00:05:45,400
So now we're going to say if let a final date is equal to chapt date which is an optional just because

62
00:05:45,400 --> 00:05:57,310
of how the ISO formatter works then we're going to say let a final date equal new formatted dot string

63
00:05:57,460 --> 00:05:58,040
from date.

64
00:05:58,040 --> 00:06:03,540
So now we're getting her we're already converting from a date to a string.

65
00:06:03,810 --> 00:06:04,110
OK.

66
00:06:04,150 --> 00:06:08,010
And the date is final date.

67
00:06:09,070 --> 00:06:17,740
And then we can actually set our time stamp label in our cell to this new labels that say time stamp

68
00:06:17,740 --> 00:06:18,670
label.

69
00:06:18,670 --> 00:06:25,250
That text is equal to final.

70
00:06:30,930 --> 00:06:32,350
That you're going to save that.

71
00:06:32,400 --> 00:06:35,400
And let's see here what do we got going on here.

72
00:06:35,400 --> 00:06:38,680
This needs to be of our students.

73
00:06:38,820 --> 00:06:41,100
This needs to be of bar right here guard bar.

74
00:06:41,130 --> 00:06:41,960
There we go.

75
00:06:42,330 --> 00:06:47,090
Let's get rid of this comment and let's try to run on this.

76
00:06:47,160 --> 00:06:48,230
All right.

77
00:06:48,510 --> 00:06:49,360
OK.

78
00:06:49,360 --> 00:06:59,310
Two forty nine 256 15 looks like it is a work and it's work you

79
00:07:01,710 --> 00:07:03,320
1:53 a.m..

80
00:07:03,330 --> 00:07:03,990
That's right.

81
00:07:04,140 --> 00:07:09,320
I'm still recording and editing videos at 2:00 a.m. for you guys.

82
00:07:09,330 --> 00:07:09,540
All right.

83
00:07:09,540 --> 00:07:19,090
Anyway so this is our final feature actually now so I won't forget you I told you I was going to teach

84
00:07:19,090 --> 00:07:21,840
you how to do this so I am.

85
00:07:22,080 --> 00:07:30,720
So now I guess this is the conclusion to the chat app so you guys have had fun and I'll see you around

86
00:07:31,300 --> 00:07:32,850
Johnny B sign in now.

