os.date problem


hook.Add("PlayerInitialSpawn","lastjoin",function(pl, ply) 
	local lastjoin = pl:GetPData("lastjoined") 
	if lastjoin == nil then
		for _,ply in pairs(player.GetHumans()) do 
			ply:PlayerMsg(Color(80,251,80),"● ",Color(255,255,255),pl:Nick().."("..pl:SteamID()..")".." has ",Color(80, 251, 80),"joined ",Color(255,255,255),"for the first time welcome!")--ply:ChatPrint(ply:Nick().."("..ply:SteamID()..")".."has joined for the first time welcome!") 
		end
	elseif lastjoin then
		for _,ply in pairs(player.GetHumans()) do
		ply:PlayerMsg(Color(80, 251, 80),"● ",Color(255,255,255),pl:Nick().."("..pl:SteamID()..")".." has ",Color(80, 251, 80),"joined
",Color(80, 80, 80),"● ",Color(255,255,255),"Last seen "..lastjoin)--ply:ChatPrint(ply:Nick().."("..ply:SteamID()..")".." has joined
Last seen "..lastjoin)
		end
	end
end)

hook.Add("PlayerDisconnected","lastjoinsave",function(pl, ply)
		pl:SetPData("lastjoined",os.date("!%d/%m/%Y %I:%M%p", os.time()))
	for _,ply in pairs(player.GetHumans()) do 
		ply:PlayerMsg(Color(255, 51, 51, 255),"● ",Color(255,255,255),pl:Nick().."("..pl:SteamID()..")".." has ",Color(255, 51, 51, 255),"left ",Color(255,255,255),"the server.")
	end
end)

This is the code I am using, it isnt storing the time properly for some reason. When i leave the server at 5:40 pm it and rejoin at 5:50 pm it doesnt say last joined 5:40 pm it says last joined 8:39 am but it is storing the date properly.

Please help, Thanks in advance

P.S This is the PlayerMsg function im using


if SERVER then
	AddCSLuaFile()
	local PLAYER = FindMetaTable("Player")
	util.AddNetworkString( "ColoredMessage" )
	function BroadcastMsg(...)
		local args = {...}
		net.Start("ColoredMessage")
		net.WriteTable(args)
		net.Broadcast()
	end

	function PLAYER:PlayerMsg(...)
		local args = {...}
		net.Start("ColoredMessage")
		net.WriteTable(args)
		net.Send(self)
	end
elseif CLIENT then
	net.Receive("ColoredMessage",function(len) 
		local msg = net.ReadTable()
		chat.AddText(unpack(msg))
		chat.PlaySound()
	end)
end

If its a hosted server maybe its getting the time from the servers clock which maybe wrong

no my server is on my home net

It’s displaying time/date using UTC+0 timezone instead of actual timezone you have. Also I suggest saving result of os.time() instead and using os.date() on clients so each client will use its own correct timezone and not timezone of the server.

thanks friend !