PluginProbe
Timetics – Appointment Booking Calendar & Scheduling / 1.0.62
Timetics – Appointment Booking Calendar & Scheduling v1.0.62
1.0.62 1.0.63 1.0.61 1.0.60 1.0.59 1.0.58 1.0.57 1.0.56 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.2 1.0.20 1.0.21 1.0.22 All 64 releases
timetics / core / dummy-data / provider / date-time.php

date-time.php in Timetics – Appointment Booking Calendar & Scheduling 1.0.62, at core/dummy-data/provider/date-time.php

49 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Phone Number Faker Class
4 *
5 * @package Timetics
6 */
7 namespace Timetics\Core\DummyData\Provider;
8
9 defined( 'ABSPATH' ) || exit;
10
11 /**
12 * Date time faker class
13 */
14 class DateTime {
15 /**
16 * Get genrated date
17 *
18 * @return string
19 */
20 public static function date( $format = 'Y-m-d' ) {
21 return gmdate( $format, self::timestamp() );
22 }
23
24 /**
25 * Get generated time
26 *
27 * @return string
28 */
29 public static function time( $format = 'h:i a' ) {
30 return gmdate( $format, self::timestamp() );
31 }
32
33 /**
34 * Get generated timestamp
35 *
36 * @return string
37 */
38 private static function timestamp() {
39 $start_timestamp = strtotime( '1970-01-01' );
40 $end_timestamp = strtotime( '2030-12-31' );
41
42 // Generate a random timestamp within the valid range
43 $random_timestamp = wp_rand( $start_timestamp, $end_timestamp );
44
45 // Format the timestamp into a valid date format
46 return $random_timestamp;
47 }
48 }
49