📋 Table of Contents
📌 Overview
The time() function converts numeric values (typically Unix timestamps or days since epoch) into human-readable date and time formats. This is useful for converting timestamp data from calculations, logs, or external sources into readable formats.
The function supports multiple format types:
- Date Formats: ISO 8601, USA (MM/DD/YYYY), European (DD.MM.YYYY)
- Time Formats: HH:MM:SS, HH.MM.SS
- DateTime Formats: Combined date and time representations
- Special Formats: Unix Timestamp, OLE Automation, Excel Format
💻 Syntax
Parameters
- value: The numeric time value to format (Unix timestamp in seconds, or days since epoch)
- format_index: Integer index (0–13) specifying the desired output format
Return Value
Returns a formatted date/time string. In the calculator display, the result is shown as a hash value but the original formatted string can be seen in tooltips and logs.
📅 Available Formats
| Index | Format Name | Pattern | Example (for 2025-02-10) |
|---|---|---|---|
| 0 | ISO 8601 | YYYY-MM-DD | 2025-02-10 |
| 1 | USA Short | MM/DD/YYYY | 02/10/2025 |
| 2 | USA Long | Month DD, YYYY | February 10, 2025 |
| 3 | Europe Short (Dots) | DD.MM.YYYY | 10.02.2025 |
| 4 | Europe Dash | DD-MM-YYYY | 10-02-2025 |
| 5 | Europe Long | DD. Monat YYYY | 10. Februar 2025 |
| 6 | Time HMS | HH:MM:SS | 14:30:45 |
| 7 | Time HM.S | HH.MM.SS | 14.30.45 |
| 8 | ISO DateTime | YYYY-MM-DDTHH:MM:SS | 2025-02-10T14:30:45 |
| 9 | Euro DateTime | DD.MM.YYYY HH:MM:SS | 10.02.2025 14:30:45 |
| 10 | USA DateTime | MM/DD/YYYY hh:mm:ss AM/PM | 02/10/2025 02:30:45 PM |
| 11 | Unix Timestamp | Epoch seconds | 1707561045 (Unix epoch seconds) |
| 12 | OLE Automation | Days since 1899-12-30 | 45,700.607 |
| 13 | Excel Format | Days since 1900-01-01 | 45,701 |
🔍 Examples
Example 1: Convert Unix Timestamp to ISO Date
time(1707561045, 0)Output: ISO 8601 format:
2025-02-10Explanation: Unix timestamp 1707561045 (seconds since 1970-01-01) is formatted as ISO 8601 date.
Example 2: Convert to USA Format
time(1707561045, 1)Output: USA Short format:
02/10/2025Explanation: Same timestamp formatted in USA standard format (MM/DD/YYYY).
Example 3: Convert to European Format
time(1707561045, 3)Output: Europe Short format:
10.02.2025Explanation: Same timestamp formatted in European standard format (DD.MM.YYYY).
Example 4: Convert Seconds to Time Format
time(52245, 6)Output: Time HMS format:
14:30:45Explanation: 52,245 seconds is converted to HH:MM:SS format (14 hours, 30 minutes, 45 seconds).
Example 5: Excel Format Conversion
time(45701, 13)Output: Excel format:
2025-02-10Explanation: Excel date number 45,701 (days since 1900-01-01) is converted to date format.
Example 6: Combined DateTime
time(1707561045, 8)Output: ISO DateTime:
2025-02-10T14:30:45Explanation: Unix timestamp formatted as ISO 8601 DateTime including time portion.
⚡ Quick Reference
📅 Date Formats (0-5)
0: ISO (yyyy-MM-dd)
1: USA (MM/dd/yyyy)
2: USA Long
3: Europe (dd.MM.yyyy)
4: Europe dash
5: Europe Long
🕐 Time Formats (6-7)
6: HMS (HH:MM:SS)
7: HM.S (HH.MM.SS)
📆 DateTime Formats (8-10)
8: ISO DateTime
9: Euro DateTime
10: USA DateTime
🔧 Special Formats (11-13)
11: Unix Timestamp
12: OLE Automation
13: Excel Format
Common Input Types
- Unix Timestamp (Seconds): Seconds since January 1, 1970 UTC
- Excel Date: Days since January 1, 1900 (format 13)
- OLE Automation: Days since December 30, 1899 (format 12)
- Seconds Duration: Total seconds (for time-only formats 6-7)