Prompt Title: Format Tanggal di PHP.

Created 11 months ago
Votes 0
Views 242 times
0
Human: 02/01/19 ubah ini menjadi 2019-02-01 di php
ChatGPT:

Anda dapat menggunakan fungsi PHP "date()" dan "strtotime()" untuk mengubah format tanggal.

Contoh:

php
$date = "02/01/19"; $new_date = date("Y-m-d", strtotime($date)); echo $new_date; // Output: 2019-02-01

Pada contoh di atas, tanggal "02/01/19" diubah menjadi "2019-02-01" dengan menggunakan format "Y-m-d" pada fungsi date(). Fungsi strtotime() digunakan untuk mengubah string tanggal ke format timestamp yang dapat dibaca oleh fungsi date().

avatar
syarifah
Shared 1 prompt
Created 11 months ago

Leave a Comment

Related Tag Prompts

392
11
0
0
category
1 year ago 2023-03-10 11:56:28 Gokk
0
0
Request for Assistance.
1 year ago 2023-03-12 18:34:16 Auspicious
0
0
PHP tutorial for beginners.
1 year ago 2023-03-15 13:20:41 imad
0
0
PHP PayPal
1 year ago 2023-03-21 06:16:23 Ad
0
5
php code for forensic image
1 year ago 2023-03-21 06:46:03 steve
0
0
PHP Address Sorting.
1 year ago 2023-03-24 12:51:27 Eric Kaiser
0
0
Laravel email multi-threading.
11 months ago 2023-04-13 10:29:12 Silvija
0
0
Laravel email queue performance.
11 months ago 2023-04-13 12:09:35 Siki
0
0
for sir pedro
10 months ago 2023-05-04 14:26:13 kris
0
0
PHP CI Helper Performance
10 months ago 2023-05-15 04:54:46 KimYeonho