EDIT: Okay, it needed to add + 1 to the length of "form" and forgot to copy to form2 while testing it.
PHP код:
GetTimeStamp(form[])
{
new form2[16], hour, minute, second, Hour[5], Minute[5], Second[5], AmPm[5];
gettime(hour, minute, second);
strcat(form2, form, strlen(form) + 1);
if(strfind(form, "tt", false) != -1) format(AmPm, sizeof(AmPm), "%s", (hour >= 12) ? ("PM") : ("AM")),
hour = (hour > 12) ? (hour - 12) : (hour), strreplace(form2, "tt", AmPm, true);
if(strfind(form, "hh", true) != -1) format(Hour, sizeof(Hour), "%02d", hour), strreplace(form2, "hh", Hour, true);
else if(strfind(form, "h", true) != -1) format(Hour, sizeof(Hour), "%d", hour), strreplace(form2, "h", Hour, true);
if(strfind(form, "mm", true) != -1) format(Minute, sizeof(Minute), "%02d", minute), strreplace(form2, "mm", Minute, true);
else if(strfind(form, "m", true) != -1) format(Minute, sizeof(Minute), "%d", minute), strreplace(form2, "m", Minute, true);
if(strfind(form, "ss", true) != -1) format(Second, sizeof(Second), "%02d", second), strreplace(form2, "ss", Second, true);
else if(strfind(form, "s", true) != -1) format(Second, sizeof(Second), "%d", second), strreplace(form2, "s", Second, true);
return form2;
}