Bifalgorithm post · Computer science one · Nested Structures
How can a date be modeled using a nested structure?
How can a date be modeled using a nested structure? (Computer science one · Nested Structures) — "Consider adding another member variable to the Student struct…
Ideas in this flowchart
- Modeling a student’s date of birth in the Student structure
- Time can be modeled as a single integer representing milliseconds since the Unix epoch
- The Unix epoch is January 1, 1970, in Coordinated Universal Time (UTC)
- The New Horizons launch corresponds to approximately 1.137 billion milliseconds since the epoch
- Time can also be modeled as a string
- ISO 8601 commonly represents time with a date, time, and offset from Greenwich Mean Time
- The New Horizons launch can be written as "2006-01-19T19:00:00+00:00"
- For simplicity, the date will be modeled with a year, a month, and a date
- A date is conceptually one entity, so separating its three numbers is not ideal
- A separate structure should be defined to represent the date