Advertisement
estranossa

Untitled

Mar 27th, 2021
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. stock ConvertUnixTime(unix_time, type = CONVERT_TIME_TO_SECONDS)
  2. {
  3. switch(type)
  4. {
  5. case CONVERT_TIME_TO_SECONDS:
  6. {
  7. unix_time %= 60;
  8. }
  9. case CONVERT_TIME_TO_MINUTES:
  10. {
  11. unix_time = (unix_time / 60) % 60;
  12. }
  13. case CONVERT_TIME_TO_HOURS:
  14. {
  15. unix_time = (unix_time / 3600) % 24;
  16. }
  17. case CONVERT_TIME_TO_DAYS:
  18. {
  19. unix_time = (unix_time / 86400) % 30;
  20. }
  21. case CONVERT_TIME_TO_MONTHS:
  22. {
  23. unix_time = (unix_time / 2629743) % 12;
  24. }
  25. case CONVERT_TIME_TO_YEARS:
  26. {
  27. unix_time = (unix_time / 31556926) + 1970;
  28. }
  29. default:
  30. unix_time %= 60;
  31. }
  32. return unix_time;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement