mengambil nama hari pada date mysql

%w pada date_format day of week , %W ( w besar ) untuk week day name,

Bismillah

q> Menggunakan %w (w kecil) untuk mengambil day of week


select
case
when date_format(now(),'%w') = 0 THEN 'AHAD'
when date_format(now(),'%w') = 1 THEN 'SENIN'
when date_format(now(),'%w') = 2 THEN 'SELASA'
when date_format(now(),'%w') = 3 THEN 'RABU'
when date_format(now(),'%w') = 4 THEN 'KAMIS'
when date_format(now(),'%w') = 5 THEN 'JUMAT'
when date_format(now(),'%w') = 6 THEN 'JUMAT'
end as hari
from dual;

q> Gimana klo %W ( w besar )

select date_format(now(),'%W') as hari from dual

query di atas akan menghasilkan nama-nama hari dalam bahasa Inggris,
ex : Friday
causebe, this query sampun dijalanken pada jumat day.

Alhamdulillah

Advertisements

membuat komponen combobox zk

Membuat komponen combobox menggunakan zk framework

Bismillah

q> buat file cobaCombobox.zul


<zk>
 <window apply="org.zkoss.bind.BindComposer"
 viewModel="@id('vm')@init('com.ipi.zk7.mywebzk7.CobaComboboxVM')"
 validationMessages="@id('vmsgs')">
 <label value="Pilih Pekerjaan :"/>
 <separator/>
 <combobox selectedItem="@bind(vm.job)">
 <comboitem label="Karyawan" value="karyawan" />
 <comboitem label="Pegawai" value="pegawai" />
 <comboitem label="Buruh" value="buruh" />
 <comboitem label="Lain-lain" value="lain" />
 </combobox>

 <button onClick="@command('simpan')" label="Tes" />

 </window>
</zk>

q> buat file CobaComboboxVM.java


package com.ipi.zk7.mywebzk7;

import org.zkoss.bind.annotation.Command;
import org.zkoss.zul.Messagebox;

public class CobaComboboxVM {

 private String job;

 public String getJob() {
 return job;
 }

public void setJob(String job) {
 this.job = job;
 }

@Command
 public void simpan(){
 Messagebox.show("Job = " + job);
 }

}

q> Hasil :

Selection_015

Selection_016

Alhamdulillah

membuat radio dalam radiogroup zk

Membuat komponen radio dalam radiogroup menggunakan zk framework

Bismillah

q> buat file cobaRadio.zul


<zk>
 <window apply="org.zkoss.bind.BindComposer"
 viewModel="@id('vm')@init('com.ipi.zk7.mywebzk7.CobaRadioVM')"
 validationMessages="@id('vmsgs')">
 <label value="Pilih Gender :"/>
 <separator/>
 <radiogroup selectedItem="@bind(vm.gender)" >
 <radio label="Pria" value="pria"/>
 <separator/>
 <radio label="Wanita" value="wanita"/>
 </radiogroup>
 <separator />
 <button onClick="@command('simpan')" label="Tes" />

 </window>
</zk>

q> buat file CobaRadioVM.java


package com.ipi.zk7.mywebzk7;

import org.zkoss.bind.annotation.Command;
import org.zkoss.zul.Messagebox;

public class CobaRadioVM {

 private String gender;

public String getGender() {
 return gender;
 }

public void setGender(String gender) {
 this.gender = gender;
 }

 @Command
 public void simpan(){
 Messagebox.show("Gender = " + gender);
 }

}

q> Hasil

Selection_013

Selection_014

membuat checkbox mvvm zk zkoss

Membuat checkbox sederhana pada framework zk (zkoss) menggunakan teknik mvvm

q> Buat file zul -> cobaCheckbox.zul


<zk>
 <window apply="org.zkoss.bind.BindComposer"
 viewModel="@id('vm')@init('com.ipi.zk7.mywebzk7.CobaCheckboxVM')"
 validationMessages="@id('vmsgs')">

 <checkbox onCheck="@command('pilih', checked = self.checked) " />


 </window>
</zk>

q> Buat file zul -> cobaCheckboxVM.java


package com.ipi.zk7.mywebzk7;

import org.zkoss.bind.annotation.BindingParam;
import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.NotifyChange;
import org.zkoss.zul.Messagebox;

public class CobaCheckboxVM {

 @NotifyChange({"cek"})
 @Command
 public void pilih(@BindingParam("checked") boolean isPicked){
 Messagebox.show("Pilih = " + isPicked);
 }

}

q> Hasil

Selection_011

Selection_012