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