Either.
So I have a small confession to make at the beginning of this video.
This is not my first time recording this.
I recorded this about a month ago along with all the other videos in this section and something happened.
I didn't save it correctly.
Maybe I accidentally deleted it.
My cat stuff on the keyboard.
I have no idea.
But the original video here is gone.
And normally that wouldn't be a problem.
It's happened before.
Or I just rerecord a section because I'm not happy with it.
You know that's not too bad.
It's easy to do.
But since this has to do with dates and in particular it has to do with these three date functions that
I'm going to show you.
Basically they give us the current date the current time and the current date time.
You'll see in the videos following this one that the code that I ran when I was recording it the first
time resulted in different dates and different times than what you'll see right now.
So it's not a big deal at all.
It's just evidence that I recorded them on different times but I wanted to just let you know what to
expect.
OK.
And the last video we inserted these to where we manually created or basically wrote out the dates the
time and the date time and then in the initial recorded version of this video.
This is the new person that I inserted and this birthdate birth time and birth date time were all done
using these three functions here that give the current birth or the current date.
So at the time it was April 21st and the time was 7 12 and this is the date time and so I used these
to generate this.
So in the next video you will see this person with toaster birth date April 20th 21st and so on.
But in this video where I'm actually showing you that creation I'm having to rerecord it.
So there's just a small discrepancy.
Other than that everything else will be the same.
So let me show you these three methods here that are really useful.
Simple things but Kuhr date gives current date as I said her time gives the current time and then now
gives current date time.
So let's try one of them just on their own.
If you did something like select her date you'll see that I'm actually recording this on 5:12 May 12th.
So not quite a month later but a couple of weeks later.
So if we do the same thing with her time
we get the time and then if we do.
Now we get the daytime.
So using them on their own is not useful really just to select the current time it's much easier just
to look at your watch but they become useful when we use them in conjunction with insert statements.
So things like when we're inserting a new user and we want to save the time that the user was inserted.
What we could do is basically write an insert into and we'll do people let's do our select start from
people.
OK.
So we'll do insert into people first date birth time and birth date time.
And so I think the hypothetical story I gave was that toaster was my son my first son and he was born
exactly at the moment when I hit enter.
So we'll do the same thing here.
Inserting into people birthdate birth time birth date time.
This would be my new son and this one's name is me actually I'd name as well.
Oh boy I'm really bad at naming things.
You can tell I named my cat blue which is blue still.
By the way you didn't catch that.
OK so I'll name him micro-wave and then rather than writing out to date here what I'll do instead is
for the birth date I just say curred date.
And then for the birth time I'll just use her time and then for birth date time I use the now and out
of all these I end up using now the most often because as I've mentioned before we use daytime's a lot.
OK so if we just run this right now and insert that and now you are select star from people you can
see that micro-wave now has the date the time the date time that reflect exactly when I inserted this.
Just a couple of seconds ago and that's pretty much all there is to these three nice simple functions.
Another way that we use them by the way is not just to insert data with current dates and times and
so on but also to compare data to the current time.
So I'll show you how to do some basic data math.
We'll be able to figure out you know how long ago something was compared to now.
And so we need to be able to refer to now where we want to figure out how many dates or how many days
somebody was born ago compared to the current date.
So we need that current date in order to help out with that.
OK.
So the last thing I'll do here just for continuity sake is the microwave that we have toaster Larry
and Padam which is what I had in the original recording so that the next video here hopefully will be
relatively seamless.
So I'm getting rid of my son I'm sorry microwave it failed you.
OK.
Now he's gone and we're back to these three.
All right.
So that's her date card time and now.