Date manipulation
This page is the answer to the task Date manipulation in the Rosetta Code.
Contents
Description (from Rosetta Code)
Task
Given the date string "March 7 2009 7:30pm EST", output the time 12 hours later in any human-readable format. As extra credit, display the resulting time in a time zone different from your own. |
Solution
Step 1. Creating the initial time
Fōrmulæ is highly internationalized software. The task requires to parse a time from a string in very localized and specific format. We prefer to get a lower score for this task in favor to show a more general form:
The initial time can be created as follows:
Explanation:
Time expressions in Fōrmulæ are never related to any any time zone. When creating the expression, one is defined in order to provide the time zone the rest of time components are referred to.
Visualizing Time expressions are, on the other hand, performed respect to the current time zone (the time zone of the computer where the program is running on). For the example, in