SA-MP Forums Archive
Timestamp to human date - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Timestamp to human date (/showthread.php?tid=412818)



Timestamp to human date - gabyk - 03.02.2013

Hi, i want to make a PAWN converter timestamp to human date, i have a java function from a site... but i don't know how to make calculations like in java functions.

PHP код:
function EpochToHuman() {
    var 
document.ef.TimeStamp.value;
    if (
e.charAt(e.length 1) == "L") {
        
e.slice(0, -1)
    }
    
1;
    var 
e;
    var 
"";
    var 
0;
    if (
>= 1e14) {
        
+= "<b>Assuming that this timestamp is in microseconds (1/1,000,000 second):</b><br/>";
        
Math.round(1e6);
        
Math.round(1e3)
    } else if (
>= 1e11) {
        
+= "<b>Assuming that this timestamp is in milliseconds:</b><br/>";
        
Math.round(1e3)
    } else {
        if (
1e101;
        
1e3
    
}
    var 
= new Date(e);
    if (
isValidDate(i)) {
        var 
i.toLocaleString();
        var 
s.search(/GMT/i);
        if (
0) {
            
s.substring(0o)
        }
        
+= "<b>GMT</b>: " i.toGMTString();
        
+= '<br/><b>Your time zone</b>: <span title="' i.toLocaleString() + '">' '</span> <a title="convert to other time zones" href="http://www.epochconverter.com/epoch/timezones.php?epoch=' '">' localTimezone(i) + "</a>";
        if (
r+= "<br/>This conversion uses your timestamp in seconds. Remove the last 3 digits if you are trying to convert milliseconds."
    
} else {
        
+= "Sorry, I can't parse this date.<br/>Check your timestamp, strip letters and punctuation marks."
    
}
    
+= '<hr class="lefthr">';
    
document.getElementById("result1").innerHTML n

Can someone will tell me how to do the calculations?


Re: Timestamp to human date - Gamer_Z - 03.02.2013

By default pawn does not have the required functions, but there is a plugin which will do what you want: https://sampforum.blast.hk/showthread.php?tid=294054


Re: Timestamp to human date - gabyk - 08.02.2013

Heh i resolved.. i made a PHP script..