Jump to content
Sign in to follow this  

function/snipset GetDayOfWeek (Xác định ngày trong tuần)

Recommended Posts

Author: No_1


Hàm này cho phép bạn có thể xác định số ngày trong tuần dựa theo thời gian thực của máy chủ. Hữu ích trong việc phân loại thời gian logs của máy chủ.

 II. Function

stock GetDayOfWeek(year, month, day) 
	new a = (14 - month)/12, y = (year + 4800) - a;
	return ((day + ((153*(month + (12*a) - 3) + 2)/5) + (365*y) + (y/4) - (y/100) + (y/400) - 32045) % 7);


CMD:test(playerid, params[])
	static const day_of_week_name[][] = {"Thu hai", "Thu ba", "Thu tu", "Thu nam", "Thu sau", "Thu bay", "Chu nhat"};
	new year, mounth, day;
	getdate(year, mounth, day);
	print(day_of_week_name[GetDayOfWeek(year, mounth, day)]);
	return 1;


  • Like 3

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.

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.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...