Time help
#1

So I made a clock and all but it shows in military time... how to fix this? I do not want it in military time

code:
Код:
new Year, Month, Day, Hour, Minute, option[32], string[128];
    getdate(Year, Month, Day);
    gettime(Hour, Minute);
    {
        new ActualDay;
        PlayerInfo[playerid][pIDay] = ActualDay;
        PlayerInfo[playerid][pIMonth] = Month;
        PlayerInfo[playerid][pIDay] = Day;
        PlayerInfo[playerid][pIMonth] = Month;
        PlayerInfo[playerid][pIYear] = Year;
        PlayerInfo[playerid][pIHour] = Hour;
        PlayerInfo[playerid][pIMinute] = Minute;
    }
Reply
#2

Try doing somthing like this:

pawn Код:
if(Hour > 12)
{
    new NonMilitaryTime = Hour - 12;
    //Make sure to add AM if NonMilitaryTime is being called
    return 1;
   
}
else if(Hour < 13)
{
    new NonMilitaryTime = Hour;
    //Make sure you use PM here for NonMilitaryTime
}
Reply
#3

Quote:
Originally Posted by jakejohnsonusa
Посмотреть сообщение
Try doing somthing like this:

pawn Код:
if(Hour > 12)
{
    new NonMilitaryTime = Hour - 12;
    //Make sure to add AM if NonMilitaryTime is being called
    return 1;
   
}
else if(Hour < 13)
{
    new NonMilitaryTime = Hour;
    //Make sure you use PM here for NonMilitaryTime
}
How would I do this?
Make sure you use PM here for NonMilitaryTime
Reply
#4

pawn Код:
new dattime[64];

if(Hour > 12)
{    
    new NonMilitaryTime = Hour - 12;    //Make sure to add AM if NonMilitaryTime is being called
    format(dattime,sizeof(dattime),"The Current Time is: %i:%d A.M.", NonMilitaryTime, Minute);
}
else if(Hour < 13)
{    
    new NonMilitaryTime = Hour;    //Make sure you use PM here for NonMilitaryTime
    format(dattime,sizeof(dattime),"The Current Time is: %i:%d P.M.", NonMilitaryTime, Minute);
}
Now where ever you put dattime you will see the time. So if it's 22:33 (Hour, Minute), you will see 10:33 P.M. (dattime)


I don't exactly see what your trying to so here (other than get the time in AM or PM), but if you can explain, I can show you how to set it up.
Reply
#5

Here is what I am trying to do...

Код:
if(!strcmp(option, "updates", true))
    {
        new File: file = fopen("updates.cfg", io_append);
        format(string, sizeof(string), "%s - [%d/%d/%d - (%d:%d > This is the time.)]\r\n", params, PlayerInfo[playerid][pIMonth], PlayerInfo[playerid][pIDay], PlayerInfo[playerid][pIYear], PlayerInfo[playerid][pIHour], PlayerInfo[playerid][pIMinute]);
        fwrite(file, string);
        fclose(file);
        format(string, sizeof(string), "AdmWarn: %s has posted updates, use /updates to view it.", RPN(playerid));
        SendClientMessageToAll(COLOR_LIGHTRED, string);
        return 1;
    }
Reply
#6

Well... Anyone?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)