Using the date selected with flatpickr in php

Hello,

I choose any time with flatpickr and save it to database in format “2023-05-11-12:49”.
When I take this date from the database and use it in php, it takes it forward 3 hours.
I know it’s because the local timezone for php is set to +3.
When I select a date with flatpickr how should I save it to database as +0 timezone?

    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css">
    <script src="https://cdn.jsdelivr.net/npm/flatpickr"></script>

<script async>
    flatpickr("#tarih", {
        altInput: true,
        altFormat: "j F Y H:i",
        dateFormat: "Y-m-d-H:i",
        defaultDate: "<?php echo $zaman['tarih']; ?>",
        allowInput: true,
        time_24hr: true,
        enableTime: true,
        locale: {
        firstDayOfWeek: 1,   
        weekdays: {
        longhand: ['Pazar', 'Pazartesi','Salı','Çarşamba','Perşembe', 'Cuma','Cumartesi'],
        shorthand: ['Paz', 'Pzt', 'Sal', 'Çar', 'Per', 'Cum', 'Cmt']
        },
        months: {
        longhand: ['Ocak','Şubat','Mart','Nisan','Mayıs','Haziran','Temmuz','Ağustos', 'Eylül','Ekim','Kasım','Aralık'],
        shorthand: ['Oca','Şub','Mar','Nis','May','Haz','Tem','Ağu','Eyl','Eki','Kas','Ara']
        },
        today: 'Bugün',
        clear: 'Temizle'
        }
    });
</script>

I solved the problem
I got date without timezone with gmdate()

Sponsor our Newsletter | Privacy Policy | Terms of Service