From c00d007c8897177af51b671a55705ec8be056591 Mon Sep 17 00:00:00 2001 From: jalel Date: Sun, 14 Dec 2025 15:20:00 +0000 Subject: [PATCH] Add Timestamp Converter tool - Live current Unix timestamp display - Timestamp to date conversion (seconds/milliseconds) - Date to timestamp conversion with timezone support - Multiple output formats (local, UTC, ISO 8601, relative) - Quick reference with common timestamps - Copy timestamps to clipboard --- app/Http/Controllers/ToolController.php | 11 + resources/views/home.blade.php | 5 + resources/views/tools/timestamp.blade.php | 383 ++++++++++++++++++++++ routes/web.php | 2 + tests/Feature/WebRoutesTest.php | 29 +- 5 files changed, 426 insertions(+), 4 deletions(-) create mode 100644 resources/views/tools/timestamp.blade.php diff --git a/app/Http/Controllers/ToolController.php b/app/Http/Controllers/ToolController.php index 8d6782c..96a4c3f 100644 --- a/app/Http/Controllers/ToolController.php +++ b/app/Http/Controllers/ToolController.php @@ -69,6 +69,12 @@ public function index(): View 'route' => 'tools.code-editor', 'icon' => 'editor', ], + [ + 'name' => 'Timestamp Converter', + 'description' => 'Convert Unix timestamps to dates and vice versa', + 'route' => 'tools.timestamp', + 'icon' => 'clock', + ], ]; return view('home', compact('tools')); @@ -123,4 +129,9 @@ public function codeEditor(): View { return view('tools.code-editor'); } + + public function timestamp(): View + { + return view('tools.timestamp'); + } } diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php index 7de13c3..88070e4 100644 --- a/resources/views/home.blade.php +++ b/resources/views/home.blade.php @@ -84,6 +84,11 @@ @break + @case('clock') + + + + @break @endswitch
diff --git a/resources/views/tools/timestamp.blade.php b/resources/views/tools/timestamp.blade.php new file mode 100644 index 0000000..7f78f80 --- /dev/null +++ b/resources/views/tools/timestamp.blade.php @@ -0,0 +1,383 @@ +@extends('layouts.app') + +@section('title', 'Unix Timestamp Converter - Convert Timestamps Online | Dev Tools') +@section('meta_description', 'Free online Unix timestamp converter. Convert timestamps to human-readable dates and vice versa. Supports seconds, milliseconds, and multiple timezones.') +@section('meta_keywords', 'unix timestamp, timestamp converter, epoch converter, date to timestamp, timestamp to date, unix time, epoch time') + +@push('schema') + +@endpush + +@section('content') +
+
+
+

Timestamp Converter

+

Convert Unix timestamps to dates and vice versa

+
+ ← Back +
+ + +
+
+

Current Unix Timestamp

+
+ + +
+

+
+
+ +
+ +
+

Timestamp to Date

+ +
+
+ + +
+ +
+ + +
+ +
+ +
+
+ Local Time + +
+
+ UTC + +
+
+ ISO 8601 + +
+
+ Relative + +
+
+
+
+ + +
+

Date to Timestamp

+ +
+
+
+ + +
+
+ + +
+
+ +
+ + +
+ + + +
+
+ Seconds +
+ + +
+
+
+ Milliseconds +
+ + +
+
+
+
+
+
+ + +
+

Quick Reference

+
+ +
+
+
+@endsection + +@push('scripts') + +@endpush diff --git a/routes/web.php b/routes/web.php index ebacbfc..ec5f18e 100644 --- a/routes/web.php +++ b/routes/web.php @@ -16,6 +16,7 @@ Route::get('/hash', [ToolController::class, 'hash'])->name('hash'); Route::get('/url', [ToolController::class, 'url'])->name('url'); Route::get('/code-editor', [ToolController::class, 'codeEditor'])->name('code-editor'); + Route::get('/timestamp', [ToolController::class, 'timestamp'])->name('timestamp'); }); // Static Pages @@ -36,6 +37,7 @@ ['loc' => route('tools.hash'), 'priority' => '0.8', 'changefreq' => 'monthly'], ['loc' => route('tools.url'), 'priority' => '0.8', 'changefreq' => 'monthly'], ['loc' => route('tools.code-editor'), 'priority' => '0.9', 'changefreq' => 'monthly'], + ['loc' => route('tools.timestamp'), 'priority' => '0.8', 'changefreq' => 'monthly'], ['loc' => route('about'), 'priority' => '0.5', 'changefreq' => 'monthly'], ['loc' => route('privacy'), 'priority' => '0.3', 'changefreq' => 'yearly'], ]; diff --git a/tests/Feature/WebRoutesTest.php b/tests/Feature/WebRoutesTest.php index 5acbe3a..da7c4ec 100644 --- a/tests/Feature/WebRoutesTest.php +++ b/tests/Feature/WebRoutesTest.php @@ -28,6 +28,7 @@ public function test_home_page_displays_all_tools(): void $response->assertSee('Hash Generator'); $response->assertSee('URL Encoder'); $response->assertSee('Code Editor'); + $response->assertSee('Timestamp Converter'); } public function test_home_page_has_tool_links(): void @@ -44,6 +45,7 @@ public function test_home_page_has_tool_links(): void $response->assertSee('href="' . route('tools.hash') . '"', false); $response->assertSee('href="' . route('tools.url') . '"', false); $response->assertSee('href="' . route('tools.code-editor') . '"', false); + $response->assertSee('href="' . route('tools.timestamp') . '"', false); } public function test_csv_tool_page_loads(): void @@ -230,9 +232,28 @@ public function test_code_editor_has_required_elements(): void $response->assertSee('monaco-container'); } + public function test_timestamp_tool_page_loads(): void + { + $response = $this->get('/tools/timestamp'); + + $response->assertStatus(200); + $response->assertSee('Timestamp Converter'); + $response->assertSee('Convert Unix timestamps to dates'); + } + + public function test_timestamp_tool_has_required_elements(): void + { + $response = $this->get('/tools/timestamp'); + + $response->assertStatus(200); + $response->assertSee('Timestamp to Date'); + $response->assertSee('Date to Timestamp'); + $response->assertSee('Current Unix Timestamp'); + } + public function test_all_pages_have_navigation(): void { - $pages = ['/', '/tools/csv', '/tools/yaml', '/tools/markdown', '/tools/sql', '/tools/base64', '/tools/uuid', '/tools/hash', '/tools/url', '/tools/code-editor']; + $pages = ['/', '/tools/csv', '/tools/yaml', '/tools/markdown', '/tools/sql', '/tools/base64', '/tools/uuid', '/tools/hash', '/tools/url', '/tools/code-editor', '/tools/timestamp']; foreach ($pages as $page) { $response = $this->get($page); @@ -244,7 +265,7 @@ public function test_all_pages_have_navigation(): void public function test_all_pages_have_theme_toggle(): void { - $pages = ['/', '/tools/csv', '/tools/yaml', '/tools/markdown', '/tools/sql', '/tools/base64', '/tools/uuid', '/tools/hash', '/tools/url', '/tools/code-editor']; + $pages = ['/', '/tools/csv', '/tools/yaml', '/tools/markdown', '/tools/sql', '/tools/base64', '/tools/uuid', '/tools/hash', '/tools/url', '/tools/code-editor', '/tools/timestamp']; foreach ($pages as $page) { $response = $this->get($page); @@ -257,7 +278,7 @@ public function test_all_pages_have_theme_toggle(): void public function test_all_pages_load_vite_assets(): void { // Code editor uses standalone template without Vite - $pages = ['/', '/tools/csv', '/tools/yaml', '/tools/markdown', '/tools/sql', '/tools/base64', '/tools/uuid', '/tools/hash', '/tools/url']; + $pages = ['/', '/tools/csv', '/tools/yaml', '/tools/markdown', '/tools/sql', '/tools/base64', '/tools/uuid', '/tools/hash', '/tools/url', '/tools/timestamp']; foreach ($pages as $page) { $response = $this->get($page); @@ -270,7 +291,7 @@ public function test_all_pages_load_vite_assets(): void public function test_all_tool_pages_have_back_link(): void { // Code editor uses standalone template with home link instead of back - $toolPages = ['/tools/csv', '/tools/yaml', '/tools/markdown', '/tools/sql', '/tools/base64', '/tools/uuid', '/tools/hash', '/tools/url']; + $toolPages = ['/tools/csv', '/tools/yaml', '/tools/markdown', '/tools/sql', '/tools/base64', '/tools/uuid', '/tools/hash', '/tools/url', '/tools/timestamp']; foreach ($toolPages as $page) { $response = $this->get($page);