get_date function of Generate Attributes Operator
![pb42](https://us.v-cdn.net/6038102/uploads/defaultavatar/nLP0QHCLH24WL.jpg)
pb42
New Altair Community Member
I am trying to understand how the generate an Hour of the Day attribute from a Date attribute. The date attribute looks like this: Feb 4, 2020 1:52:34 AM EST.
I have been trying to determine what are the elements of the date_get function, but cannot figure that out. If I had an example of what goes into the function that may help. The information button provides a generic example, but that does not make sense to me.
I have been trying to determine what are the elements of the date_get function, but cannot figure that out. If I had an example of what goes into the function that may help. The information button provides a generic example, but that does not make sense to me.
Tagged:
1
Best Answers
-
hello @pb42 so get_date gets a piece of a date for you. For example, if you have that date you showed and you only want the month in a new attribute, you would do
monthOnly get_date(att1,DATE_UNIT_MONTH)
so now the attribute would be
att1 monthOnly
Feb 4, 2020 1:52:34 AM EST Feb
1 -
So, the first element appears to be the attribute name. What does the second element do? Would changing it to DATE_UNIT_YEAR give me the year?yes. Exactly.
Scott1
Answers
-
hello @pb42 so get_date gets a piece of a date for you. For example, if you have that date you showed and you only want the month in a new attribute, you would do
monthOnly get_date(att1,DATE_UNIT_MONTH)
so now the attribute would be
att1 monthOnly
Feb 4, 2020 1:52:34 AM EST Feb
1 -
Thank you.
So, the first element appears to be the attribute name. What does the second element do? Would changing it to DATE_UNIT_YEAR give me the year?2 -
So, the first element appears to be the attribute name. What does the second element do? Would changing it to DATE_UNIT_YEAR give me the year?yes. Exactly.
Scott1 -
Thank you again. This is very helpful.2