Hey there stranger!

Sign up to get access.

How to Format Timestamp to Day and Month

About this Tutorial

Video Transcript

0:00 There's something tricky about setting the format of a timestamp over here on the right. I have function set date I have variable timestamp equals new date That's how you set a timestamp, but I want to format it right now This is what it looks like if I just run set date You'll see over here on the left
0:17 . It's just the date and the time but if we want to format this, sometimes you will wrap this new date with a format.
0:25 So you'll say variable new time or format did timestamp equals utilities dot format date and here you'll take new date We'll format it in GMT, we will also change the format to let's say year year year and hour hour hyphen minute minute.
0:52 We'll save this, we'll run it again. We'll make sure to actually use the formatted timestamp. Let's do that. We'll hit run and we get this, right.
1:08 Well in the documentation, we'll look over here, it says that we can also do something like the full name and it says DDD plus.
1:18 Let's try that. That's a full name. Same of the day of the week, uh cause maybe we want one year, we want the day of the month without a leading number.
1:27 Let's try that one and see what that looks like. Looks like that, number 13. Let's do DD, save it, run it.
1:38 Thank you. Same with a leading zero if we were in leading zeros. Let's do DDD. Now what DDD should be is day of the week with a three letter abbreviation.
1:48 Let's run it. Ah, it's 013. And if we do 4Ds run, but maybe we need to do a plus sign.
1:59 Oh, here that's weird. This should be like the day, oh that's 13, but it says here day of the week three letter abbreviation.
2:07 Well, formatting of this date to get this particular format, this day of the week with full name, we need to do something different than this utilities.format date.
2:19 What we need to do, It's actually format the column or the cell after we append the row. So we can leave this here as set date.
2:32 And this is what we have to do. We have to create a function timestamp, variable timestamp, sorry. We're going to append it with the timestamp set date.
2:40 Same as set date. But then we're going to get the last row, which is going to be the row we just appended to.
2:47 And we're going to set the number format. And in this case we are setting it to four d's, five m's, and two d's.
2:56 So let's see what that does. We'll select Set Format and Date. We'll run that. I think we need to actually do Set Date and Format.
3:07 Let's run that. And now we have Tuesday, August 13th. I don't know if you saw that, uh, how fast it does or how slow it does it.
3:16 But let me add a another second here. Utilities. And I'm going to do actually two seconds. So we will save that and we will run it.
3:29 And it will enter the number and then wait two seconds and then format it. And this case, using this Set Number Format, we can.
3:40 We can use this DDD to set the three letter abbreviation or a full name of the day, Tuesday. So that's really cool and it's really good to know in case you want to fool around with the new date, Utilities.FormatDate.
3:58 It doesn't work like that. You need to use this. SetNumberFormat in the ah cell after you set the timestamp. But the cool thing about this is that once you double click on here you still have all of the information of the timestamp even though you have a nice formatted date with the full name of the 
4:17 day.