View Single Post
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 01-31-2009 , 12:38   Re: How to create timestamp ?
Reply With Quote #3

A timestamp isn't just hours and minutes, it also contains the year and the date. To be more exact it's the seconds since 1970. I think there is no way
with sourcemod to calculate a timestamp based on a datetime.
So you have to compare the hours and minutes as numbers and calculate the time difference yourself.

Time difference = (currentHours*3600+currentMinutes*60)-(keyValueHours*3600+keyValueMinutes*60)

KeyValuesTimestamp = GetTime() - Time difference

I'm not sure if that's what you want, but I think it might give you a hint how to start
__________________
Why reinvent the wheel ? Download smlib with over 350 useful functions.

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter than "Yes"
powered by Core i7 3770k | 32GB DDR3 1886Mhz | 2x Vertex4 SSD Raid0

Last edited by berni; 01-31-2009 at 12:40.
berni is offline