A real problem - Date to Timestamp - help
#1

So, i have a last login on a player saved like this:

2018-12-26 19:42:18

How can I get the exact timestamp on this date?

I have already timestampdate.inc but the format should be like: 26.12.2018 (probably in your country: 12.26.2018 ), and i can't specify the hours, minutes and seconds.

Does anybody know a function that i convert the date above (2018-12-26 19:42:18 ) to unixtime?

I really need this.

Thanks!
Reply
#2

Perhaps, getdate and gettime?

PHP код:
new dmygetdate(ymd);
new 
hmnsgettime(hmns); 
Reply
#3

No, I already have the date: 2018-12-26 19:42:18 but I want to be in timestamp,
like: 1545846977 (2018-12-26T17:56:17+00:00) - source: wikipedia.
Reply
#4

So you technically only need to extract the day, month, year and hour, minute and second to pass it to a function from the include, right? There should be DateToTimestamp which takes the date as seperate values.

You could use sscanf for it, if the format is always going to be the same.

PHP код:
new daymonthyearhourminutesecond;
sscanf(date_string"p<-:>iiiiii"yearmonthdayhourminutesecond); 
Reply
#5

PHP код:
new    Timestamp gettime(HourMinuteSecond); 
This?

Outputs like this: 1545848117
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)