Rabu, 07 Agustus 2013

PHP Indonesia - Facebook: [Tanya-Bertanya] para agan yang master2 Fungsi PH...

PHP Indonesia - Facebook
PHP Indonesia is a community for everyone that loves PHP. Our focus is in the PHP world but our topics encompass the entire LAMP stack. Topics include PHP coding, to memcached handling, db optimizations, server stack, web server tuning, code deploying, hosting options and much much more. Youtube Channel : http://www.youtube.com/user/OurPHPIndonesia Twitter : @php_indonesia NOTE: Rules for Wall posting: https://www.facebook.com/groups/35688476100/doc/10151597056316101/ Daftar Keanggotaan : http://www.facebook.com/groups/35688476100/doc/10150671770741101/ 
[Tanya-Bertanya] para agan yang master2 Fungsi PH...
Aug 7th 2013, 07:23, by Ridho Tobing No Xvii

Ridho Tobing No Xvii 7:23am Aug 7
[Tanya-Bertanya] para agan yang master2

Fungsi PHP untuk mendapatkan nama Hari dalam bahasa Indonesia dari database yang berformat 'date'
misal : di record tanggal = '2013-08-01'
dari record itu bisa didapatkan nama harinya sesuai dengan tanggal sebenarnya
Mintol solusi nya master

Muhammad Saleh Hafizh Fajri 7:24am Aug 7
gunakan select date_format

Ridho Tobing No Xvii 7:26am Aug 7
ane gunakan date_format(tanggal, '%D/%m/%Y') hasilnya 1st-08-2013

Dimas Edubuntu Samid 7:26am Aug 7
SELECT DATE_FORMAT(tanggal, '%d %F %Y') as Tanggal

Dimas Edubuntu Samid 7:26am Aug 7
untuk parameter

d -> day 1 digit
D -> day 2 digit : 02
m -> bln 2 digit : 12
M -> bln 3 digit : Jun , Apr
F -> bln full : January, Februari, March
y -> thn 2 digit : 90
Y -> thn 4 digit : 2013

Ridho Tobing No Xvii 7:28am Aug 7
tes dulu yak

Muhammad Saleh Hafizh Fajri 7:30am Aug 7
ini referensi nya
http://www.w3schools.com/sql/func_date_format.asp

Dimas Edubuntu Samid 7:30am Aug 7
(Y)

Muhammad Saleh Hafizh Fajri 7:31am Aug 7
day name itu %w lihat di link yang ane kasih

Ridho Tobing No Xvii 7:32am Aug 7
%F = F

Muhammad Saleh Hafizh Fajri 7:33am Aug 7
%w , lihat link diatas itu ane kasih lengkap

ini ane pastein :v

The formats that can be used are:

Format Description
%a Abbreviated weekday name
%b Abbreviated month name
%c Month, numeric
%D Day of month with English suffix
%d Day of month, numeric (00-31)
%e Day of month, numeric (0-31)
%f Microseconds
%H Hour (00-23)
%h Hour (01-12)
%I Hour (01-12)
%i Minutes, numeric (00-59)
%j Day of year (001-366)
%k Hour (0-23)
%l Hour (1-12)
%M Month name
%m Month, numeric (00-12)
%p AM or PM
%r Time, 12-hour (hh:mm:ss AM or PM)
%S Seconds (00-59)
%s Seconds (00-59)
%T Time, 24-hour (hh:mm:ss)
%U Week (00-53) where Sunday is the first day of week
%u Week (00-53) where Monday is the first day of week
%V Week (01-53) where Sunday is the first day of week, used with %X
%v Week (01-53) where Monday is the first day of week, used with %x
%W Weekday name
%w Day of the week (0=Sunday, 6=Saturday)
%X Year of the week where Sunday is the first day of week, four digits, used with %V
%x Year of the week where Monday is the first day of week, four digits, used with %v
%Y Year, four digits
%y Year, two digits

Al Ghurahy 7:33am Aug 7
pertanyaanya nama hari kan?
adanya bhs inggris tp bs aja dibuat return angka harinya lalu dipake mengindex array yg berisi nama2 hari dlm bhs ind.

$hari = array("Minggu","Senin","Selasa","Rabu","Kamis","Jumat","Sabtu");
echo $hari[date("w", $tanggalmutadi)];

Ridho Tobing No Xvii 7:37am Aug 7
nemu..

Ridho Tobing No Xvii 7:41am Aug 7
Al Ghurahy ..
<?
$hari = array("Minggu","Senin","Selasa","Rabu","Kamis","Jumat","Sabtu");
echo $hari[date("w", 2013-08-13)];
?>

outputnya==kamis

Dimas Edubuntu Samid 7:41am Aug 7
(Y)

Al Ghurahy 7:47am Aug 7
wah salah dong? coba cek dl udah bener gak output angka yg jd index nya?

pd prinsipnya date("w", $tanggal) ngikut ini:

http://php.net/manual/en/function.date.php

jd keluarnya angka 0 s.d 6 (minggu s.d sabtu)

kl salah mngkn hrs

$index = date("w", strtotime($string_tanggalanmu));

You are receiving this email because you subscribed to this feed at blogtrottr.com.

If you no longer wish to receive these emails, you can unsubscribe from this feed, or manage all your subscriptions

Tidak ada komentar:

Posting Komentar