Jump to content

[Include] TimestampToDate


Arabu
 Share

Recommended Posts

On 6/6/2018 at 2:50 PM, Arabu said:
TimestampToDate & DateToTimestamp


Hello,

Unix Timestamps for beginners
For those who are not familliar with Unix Timestamps, take a look at Wikipedia (press the link).

Introduction
Today, I'll present one of my new works: TimestampToDate. This library is able to convert your specified timestamp to a date.

- Timezone supported.
- Leap years supported.
- Easy to use

The syntaxes are as followed:


Explanation

 

stock TimestampToDate(Timestamp, &year, &month, &day, &hour, &minute, &second, HourGMT, MinuteGMT = 0)

stock TimestampToDate(Timestamp, &year, &month, &day, &hour, &minute, &second, HourGMT, MinuteGMT = 0)

Notice the last two parameters. GMT is the timezone in which we live. It's taken as the standard timezone. You should only fill in MinuteGMT if you live in a timezone which has for example: 6.5.

The year, month, day, hour, minute and second parameters should be filled in like you do in getdate and gettime.


Since v2.0, this library contains a new stock: DateToTimestamp. I will explain this as well.

 

stock DateToTimestamp(str[11])

stock DateToTimestamp(str[11])

You could compare this with strtotime/mktime in PHP. The only parameter is a string, which is the date that should be converted to a timestamp. It should be in the following format: 06.04.2013. The "." here is the splitter. It can be changed to any character you wish (as long as you don't use numeric characters, it will probably work). It should be changed by redefining "#SPLITTER" after including this library.

Download
v2.0 -->

Protected content!

  • Reply to this topic to see the protected content.


Example -->

Protected content!

  • Reply to this topic to see the protected content.

 


Instalation
- Open the link and press RAW.
- Copy all text and save it right here: "server_dir/pawno/includes" under filename: TimestampToDate.inc.
- Add "#include <TimestampToDate>" in the script you'd like to use it (gamemode?).

 

 

 

Link to comment
Share on other sites

  • 2 weeks later...
  • 4 weeks later...
  • 2 weeks later...
  • 2 weeks later...
  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...