Skip to content

Instantly share code, notes, and snippets.

View abdes-zakari's full-sized avatar

Zakari Abdessamad abdes-zakari

View GitHub Profile
@abdes-zakari
abdes-zakari / convertWindowsFiletime.php
Last active May 17, 2021 15:33
PHP: Convert Windows Filetime to Date(UnixTime)
<?php
// Windows Filetime: a time value is simply a counter of ticks since an defined start of time, called epoch. Not only the "epoch date" differs between various systems, but also the counter resolution, that is how often it is updated.
// Windows uses in most functions the FILETIME structure, which represents the actual time as the number of 100-nanosecond intervals since January 1, 1601 (UTC).
# Example:
// 13228475598575215 microseconds from 1601-01-01T00:00:00Z => convert it to seconds = 13228475598575215/1000000 = 13228475598.575 seconds
// 11644473600 seconds between 1601-01-01T00:00:00Z and 1970-01-01T00:00:00Z
//in web.php:
Route::post('/profile/edit/save', 'AccountUserController@saveProfile')->name('save_profile');
// html code
<form class="profile-data" enctype="multipart/form-data" method="POST" action="{{ route('save_profile') }}">
{{ csrf_field() }}
<input type="hidden" name="id_user" value="{{ $user->id}}">
<div class="row r-avatar">
<div class="col-md-4" style="border:0px solid">
<img src="{{ URL::asset('frontend/img/avatars/')}}/{{ $user->user_avatar}}" alt="Avatar" style="width:100px;height:100px;max-width: none;" class="img-thumbnail img-circle">