Arsip: field int to field date

 
user image
more 12 years ago

idhiel

para master delphi..mohon bantuannya,.. aq punya field bertype integer aq mau pindahkan recordnya ke field bertype date.. gimana codingx... dbf1[cycle] := strtodate(inttostr(dbf2[cycle])); klo coding diatas muncul error not valid date mohon pencerahannya para master...
user image
more 12 years ago

halimanh

Jadi dbf2[cycle] itu integer yg menyimpan tahun, bulan dan tgl ? Formatnya gimana ? yyyymmdd ? Jadi kalo dbf2[cycle] = 20120614 apakah artinya tahun 2012, bulan 06, tgl 14? Kalo iya, pake kode berikut

var
  tahun, bulan, tgl : word;
...
  tahun := dbf2[cycle] div 10000;
  bulan := (dbf2[cycle] mod 10000 ) div 100;
  tgl := (dbf2[cycle] mod 10000 ) mod 100;
  dbf1[cycle] := EncodeDate(tahun, bulan, tgl);
[/pas]
user image
more 12 years ago

idhiel

field dbf2 itu berisi record = 60512 yg artinya 6 = tanggal 05 = bulan 12 = tahun mohon pencerahannya Gan..
user image
more 12 years ago

halimanh


  tahun := angka1 mod 100 + 2000;
  bulan := angka1 mod 10000 div 100;
  tgl := angka1 div 10000;
user image
more 12 years ago

halimanh

@halimanh:

  tahun := angka1 mod 100 + 2000;
  bulan := angka1 mod 10000 div 100;
  tgl := angka1 div 10000;
ehh...di ralat:

  tahun := dbf2[cycle]  mod 100 + 2000;
  bulan := dbf2[cycle]  mod 10000 div 100;
  tgl := dbf2[cycle]  div 10000;
dbf1[cycle] := EncodeDate(tahun, bulan, tgl);
user image
more 12 years ago

idhiel

aq coba dulu yah gan..but tks atas bantuannx... :D :D :D
more ...
  • Pages:
  • 1
Share to

AI Forward

🚀 We're thrilled to partner with Alibaba Cloud for "AI Forward - Alibaba Cloud Global Developer Summit 2025" in Jakarta! Join us and explore the future of AI. Register now: https://int.alibabacloud.com/m/1000400772/
#AlibabaCloud #DeveloperSummit #Jakarta #AIFORWARD

Local Business Directory, Search Engine Submission & SEO Tools FreeWebSubmission.com SonicRun.com