Beruntunglah VBA mempunyai fungsi fungsi yang dapat dipergunakan untuk pengelolaan tanggak dan waktu. Berikut ini adalah fungsi tanggal dan waktu yang sering dipergunakan:
1. DATESERIAL
Mengisi/menginput tanggal kedalam suatu variabel
Format:
DateSerial («tahun», «bulan», «tanggal»)
Contoh:
Dim tgl As Date
tgl = DateSerial(14,11,5)
hasilnya > tgl = 5/11/2014
2. TIMESERIAL
Mengisi/menginput waktu kedalam suatu variabel
Format:
TimeSerial («jam», «menit», «detik»)
Contoh:
Dim wkt As Date
wkt = TimeSerial(18, 21, 52)
hasilnya > wkt = 18:21:52
3. DATEDIFF
Menghitung selisih tanggal atau selisih waktu, diperlukan interval untuk menyatakan object yang dihitung selisihnya
Format:
DateDiff («interval», «tanggal1», «tanggal2»)
DateDiff («interval», «waktu1», «waktu2»)
catatan interval:
tahun = yyyy
bulan = m
tanggal = d
jam = h
menit = n
detik = s
Contoh:
Dim tgl1, tgl2,tgl3 As Date
tgl1 = DateSerial(11,9,5)
tgl2 = DateSerial(14,11,5)
tgl3 = DateDiff("yyyy", tgl1, tgl2)
hasilnya > tgl3 = 3
4. WEEKDAY
Mencatat hari sesuai dengan tanggal, dimana hari dinyatakan dengan angka
1 = Minggu
2 = Senin
3 = Selasa
4 = Rabu
5 = Kamis
6 = Jumat
7 = Sabtu
Format:
Weekday («tanggal»)
Contoh:
Dim tgl1 As Date
Dim tgl2 As Integer
tgl1 = DateSerial(14, 4, 19)
tgl2 = Weekday(tgl1)
hasilnya > tgl2 = 7
5. DAY
Menampilkan tanggal
Format:
Day(«tanggal»)
Contoh:
tgl = Day("1/31/99")
hasilnya > tgl = 31
6. MONTH
Menampilkan bulan
Format:
Month(«tanggal»)
Contoh:
tgl = Month("1/31/99")
hasilnya > tgl = 1
7. YEAR
Menampilkan tahun
Format:
Year(«tanggal»)
Contoh:
tgl = Year("1/31/99")
hasilnya > tgl = 99
8. HOUR
Menampilkan jam
Format:
Hour(«waktu»)
Contoh:
wkt = Hour("8:21:53")
hasilnya > wkt = 8
9. MINUTE
Menampilkan menit
Format:
Minute(«waktu»)
Contoh:
wkt = Minute("8:21:53")
hasilnya > wkt = 21
10. SECOND
Menampilkan menit
Format:
Second(«waktu»)
Contoh:
wkt = Second("8:21:53")
hasilnya > wkt = 53
11. DATE
Menampilkan tanggal saat ini
Contoh:
tgl = Date
hasilnya > tgl = tanggal saat ini, misalnya 19/04/2014
12. TIME
Menampilkan waktu saat ini
Contoh:
wkt = Time
hasilnya > tgl = waktu saat ini, misalnya 8:40:53
13. NOW
Menampilkan tanggal dan waktu saat ini
Contoh:
x = Now
hasilnya > x = tanggal dan waktu saat ini, misalnya 19/04/2014 8:40:53
14. DATEADD
Menjumlahkan tanggal atau waktu, diperlukan interval untuk menyatakan object yang dijumlahkan
Format:
DateAdd («interval», «angka», «tanggal»)
catatan interval:
tahun = yyyy
bulan = m
tanggal = d
jam = h
menit = n
detik = s
Contoh:
Dim tgl As Date
tgl = DateSerial(11,9,5)
tgl = DateAdd("yyyy", 7, tgl)
hasilnya > tgl = 05/09/2018
Contoh 2:
Dim wkt As Date
wkt = TimeSerial(8,5,26)
wkt = DateAdd("n", 25, wkt)
hasilnya > wkt = 8:30:26
15. DATEVALUE
Merubah text menjadi tanggal
Format:
DateValue («text»)
Contoh:
tgl = DateValue("5/9/2014")
hasilnya > tgl = 05/09/2014
16. TIMEVALUE
Merubah text menjadi tanggal
Format:
TimeValue («text»)
Contoh:
wkt = TimeValue("9:0:26")
hasilnya > wkt = 9:00:26
www.AstroDigi.com (Nino Guevara Ruwano)
ninest123 07.31
true religion jeans, oakley sunglasses, louboutin, michael kors outlet, michael kors outlet, coach outlet, longchamp outlet, tiffany jewelry, christian louboutin outlet, michael kors, kate spade outlet, prada handbags, ray ban sunglasses, gucci outlet, tiffany and co, replica watches, michael kors outlet, coach outlet, nike air max, polo ralph lauren outlet, louboutin shoes, ray ban sunglasses, tory burch outlet, michael kors outlet, jordan shoes, nike air max, oakley sunglasses, chanel handbags, coach purses, kate spade handbags, nike free, coach factory outlet, burberry, longchamp outlet, burberry outlet online, nike outlet, prada outlet, oakley sunglasses, polo ralph lauren outlet, longchamp, michael kors outlet, louboutin outlet
wedding dresses, soccer jerseys, nike roshe, abercrombie and fitch, iphone 6 cases, ferragamo shoes, reebok shoes, soccer shoes, ghd, asics running shoes, nike huarache, lululemon, vans shoes, instyler, nike roshe, oakley, insanity workout, p90x workout, mcm handbags, north face outlet, beats by dre, celine handbags, bottega veneta, baseball bats, north face outlet, longchamp, giuseppe zanotti, hollister, valentino shoes, new balance, nfl jerseys, hollister, jimmy choo shoes, babyliss, herve leger, mac cosmetics, birkin bag, timberland boots, chi flat iron, nike trainers, mont blanc, nike air max
swarovski, replica watches, toms shoes, ugg boots, supra shoes, marc jacobs, montre pas cher, links of london, thomas sabo, vans, hollister, ugg pas cher, ugg,ugg australia,ugg italia, nike air max, ray ban, ugg boots uk, ugg boots, ugg,uggs,uggs canada, karen millen, gucci, bottes ugg, lancel, uggs on sale, ralph lauren, hollister, converse, wedding dresses, pandora charms, louboutin, juicy couture outlet, converse outlet, juicy couture outlet, pandora charms, swarovski crystal, ugg boots, coach outlet, pandora jewelry, ugg boots
ninest123 07.31
toms outlet
michael kors handbags
michael kors outlet
ed hardy outlet
michael kors outlet
yeezy boost 350 white
mont blanc pens outlet
cheap nfl jerseys
christian louboutin shoes
nike trainers
jordan shoes
ray ban glasses
discount oakley sunglasses
adidas sneakers
adidas store
michael kors outlet canada
ugg boots
nfl jerseys wholesale
michael kors outlet store
coach outlet online
20161114yuanyuan
lebron james shoes
air jordan
balenciaga sneakers
louboutin shoes
nike air vapormax
coach factory outlet
jordan shoes
michael kors handbags sale
coach outlet
yeezy shoes