Jump to content
Sign in to follow this  
cade

Kira Bulan Guna Vbscript

Recommended Posts

dear all,

camana nak kira bulan guna vbscript, aku sebenarnya dah lupa.

Sample scenario: 27/5/1996 - 30/06/1996 dan jawapan nya dua bulan

camana nak kira nih dalam vbscript

harap banyak membantu

sila reply ke email: [email protected]

Share this post


Link to post
Share on other sites

Hi cade,

Aku pun ingat-ingat lupa.. tapi nyatanya guna datediff

strMonth = DateDiff("m", "27/5/1996","30/06/1996")

msgbox strMonth

dia akan return 2.. kalau tak salah aku lar.. anyway bih kurang camtuh lar

Share this post


Link to post
Share on other sites

lama tak dpt reply dari ko..apa khabar...

code yg ko bagi tuh, dia return 1 jer lah....

sblm nih aku ingt nak retrieve record lama kat putera.com. Las2 kena reconstruct lak...

cheh...construct dah la amik masa lama lak tuh..

Any way .....thnks

Share this post


Link to post
Share on other sites

Hi cade,

Ok lar... aku biasa jerk biggrin.gif aku pun tersasyul.................. 1 bulan ler hehhehe

Share this post


Link to post
Share on other sites

apa yang takkena dgn code ni cade??

aku buat ok je..

cuba bukak notepad, save as fail.vbs lepas tu run kan fail tu

kalau nak buat dalam asp, perkataan "msgbox" tu kau tukar pada "response.write" dan tambah "<%" dan "%>" utk awal line dan last line.

fail.vbs

=======

strMonth = DateDiff("m", "27/5/1996","30/06/1996")

msgbox strMonth+1

fail.asp

=====

<%

strMonth = DateDiff("m", "27/5/1996","30/06/1996")

response.write strMonth+1

%>

ok? complete tak explain tu

wassalam..

Share this post


Link to post
Share on other sites

lagu satu jgn lupa.... format tarikh dlm VB ni ikut standard American

MM/DD/YY

yg korang buat kat atas tu DD/MM/YY

so coding tu cuba buat cam ni. taip dgn notepad save sbg cth: kira.vbs

bulan=datediff("m", "7/30/1996", "9/30/1996")

msgbox bulan & " bulan"

Jawapan : 2 bulan

P/S: aku baru tau rupanya boleh buat coding VBS terus pakai notepad je...

Share this post


Link to post
Share on other sites

just pergi setting regional, then set kat sana....

betulkan aku kalo salah

aku rasa ada cara kalo nak ikut kita punya standard guna vb

ph34r.gif

Share this post


Link to post
Share on other sites

darkranger,

format tarikh tak ikut VB, tapi dia ikut regional setting dalam PC kita

kalau dalam regional setting date dlm PC kita di set DD/MM/YYYY

==========================================

jawapan dibawah ialah 0 bulan

bulan=datediff("m", "7/3/1996", "9/3/1996")

msgbox bulan & " bulan"

kalau dalam regional setting date dlm PC kita di set MM/DD/YYYY

==========================================

jawapan dibawah ialah 2 bulan

bulan=datediff("m", "7/3/1996", "9/3/1996")

msgbox bulan & " bulan"

wassalam

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...