Log Timestamp
beginnerMatches common timestamp formats found in log files.
logtimestampdatetimeparsing
Pattern
/\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:?\d{2})?/gTry It
0 of 6 strings matched
Explanation
Matches ISO-style timestamps with T or space separator, optional fractional seconds, and optional timezone (Z or ±HH:MM).
Test Strings
Matching
- 2024-01-15T09:30:00Z
- 2024-01-15 09:30:00.123+05:30
- 2024-01-15T09:30:00
Non-matching
- Jan 15, 2024
- 09:30:00
- not-a-timestamp
Language Compatibility
| Language | Support |
|---|---|
| JS | Full support |
| PYTHON | Full support |
| JAVA | Full support |
| PHP | Full support |
| GO | Full support |
Code Snippets
const regex = /\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:?\d{2})?/g;
const text = "your text here";
const matches = text.match(regex);
console.log(matches);