SPSS Date and Timestamps Variable
In this section, we will learn the Date variable type. Date variable type can be used when we want to enter our data in the form of some timestamps or time series, or simply record the birth date of the subject. For example, in our hardwork and performance study, suppose we want to record the birth date of the subject and we want to see the impact on birth date variables. For this, we will change the Numeric to Date type like this:
We can define a new variable, and that should be the date variable. So we will define it as Birthdate, and by default, it is a Numeric variable. Let’s convert it into a Date variable. Once we click on the Date, we will see many options on the right-hand side, and we can notice it gives us a date format like dd-mmm-yyyy. In the format, the first 2 digits define our date, the first 3 letters define the month, and 4 digits define the year.
So it is prompting us to define date in the format of 12-Jun-1970 where 12 defines our date, Jun defines the month, 1970 defines the year. This is the typical format we generally use, but if we want to use any other format, we can select accordingly. So once we select, let’s try to define date variable or entry for date variable. So let’s define as 10-Dec-1995. We put dash(-) because the dash was there in the format. If we don’t put a dash, we make an error warning. So we can correct accordingly.
We can see our first date entry has been done in the above image, and it is 10-Dec-1995. Now let’s enter our second entry, which is 18-Oct-1993.
So we have two entries now. Now let’s try to change the date format into something else, and we can see all the changes will be reflected in our data. We don’t need to do the changes manually. We need just to select the right format. So we can go for some other format as well. We select a more complex format like dd-mmm-yyyy hh:mm:ss:ss, which means date, month, year, hours, minutes, seconds, milliseconds.
When we choose this format and click on Data view option, the Birthdate will look like this:
This format is useful if we are working in hospitals where we are recording the birth of kids. We can record the exact birth upto milliseconds, and that’s going to be useful for us.