...
Both can be done with the Calculate Days Elapsed for Traffic Light Post Function which initialises the information required for tracking the day elapsed.
Prerequisite
Besides a Traffic Light custom field, there should also be a configuration for an existing Days mapping.
Otherwise, refer to steps here to create a Traffic light custom field, or configure the Days Mapping.
Adding the Post Function
For the basics on setting up a workflow, please refer to Jira's documentation on configuring workflows
...