Raised This Month: $ Target: $400
 0% 

GetTime offset relative to server's timezone


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 10-06-2020 , 13:30   Re: GetTime offset relative to server's timezone
Reply With Quote #1

How about, this way ?

PHP Code:
#include <sdktools>

public void OnPluginStart()
{
    
RegConsoleCmd("sm_test"test);
}

public 
Action test(int clientint args)
{
    
char buffer[60];
    
FormatTime(buffersizeof(buffer), "%z");

    
// Example "%Z", output: "FLE Daylight Time"
    // **** Standard Time = disabled, Daylight Saving Time (DST)
    // **** Daylight Time = enabled, Daylight Saving Time (DST)

    
int offset StringToInt(buffer);

    
int minutes offset 100// 0 - 99
    
int hours offset 100;
    
    
offset = (hours*3600) + (minutes*60);
    
    
PrintToServer("FormatTime UTC%s, offset %i seconds"bufferoffset);


    return 
Plugin_Handled;

*edit
And... GetTime() returns UNIX time, which is UTC-0.
But FormatTime returns with timezone+dts.

Last edited by Bacardi; 10-06-2020 at 13:55.
Bacardi is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 22:42.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode