Jump to content
  • 0

[Suggestion] gettimestr


nanakiwurtz

Question


  • Group:  Members
  • Topic Count:  81
  • Topics Per Day:  0.02
  • Content Count:  1654
  • Reputation:   583
  • Joined:  08/09/12
  • Last Seen:  

Hello, I have a script to test:

prontera,145,150,5	script	gettimestr	735,{
	dispbottom "1a: "+getstrlen(gettimestr("%Y/%m/%d",20));
	dispbottom "1b: "+gettimestr("%Y/%m/%d",20);
	
	dispbottom "2a: "+getstrlen(gettimestr("%Y/%m/%d",10));
	dispbottom "2b: "+gettimestr("%Y/%m/%d",10);
	
	dispbottom "3a: "+getstrlen(gettimestr("%Y/%m/%d",8));
	dispbottom "3b: "+gettimestr("%Y/%m/%d",8);
}

It prints:

1a: 10
1b: 2015/11/15
 
2a: 0
2b:
 
3a: 0
3b:

Line 1a and 1b works just fine, while line 3a and 3b doesn't even print anything.

What I'm questioning here is the line 2a and 2b, why it doesn't work even line 1a prints 10?

To make line 2a and 2b work, it needs 1a + 1 = 11

 

Current syntax: gettimestr(<format string>,<max length>);

The format string length (%Y, %m,  %d, etc) is always 2 for each.

So what I'm suggesting here is to remove max length and make it to count automatically by counting the length of <format string> minus 2 for each %x, add by it's corresponding length (%y=2, %Y=4) then +1.

 

For example: 

dispbottom ""+gettimestr("%Y/%m/%d");

%Y = 4, / = 1, % m= 2, / = 1, %d = 2 -> 4 + 1 + 2 + 1 + 2 = 10, but we need to add 1 to make it to work, so it will be 11.

 

Buuuuttt.. There is a catch..

The user locale settings is surely different for each systems, like %A (Full weekday name according to locale settings), %B (Full month name according to locale settings), etc

 

So I don't know if this suggestion even makes sense or not... /hmm

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

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

Guest
Answer this question...

×   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.

×
×
  • Create New...