WPDK  1.5.0
WordPress Development Kit
 All Data Structures Files Functions Variables Pages
WPDKDateTime Class Reference
Inheritance diagram for WPDKDateTime:
WPDKObject

Static Public Member Functions

static format ($date, $to= 'm/d/Y H:i')
 Format a date time. More...
 
static expirationDate ($date, $duration, $duration_type)
 Return expiration timestamp date. More...
 
static daysToDate ($date)
 Return the number of days to a expiration date. More...
 
static timeNewLine ($datetime)
 
static isExpired ($exipration)
 Check if a date is expired. More...
 
static isInRangeDatetime ($date_start, $date_expire, $format= 'YmdHis', $timestamp=false)
 Check for date range. More...
 
static mySQLDate ($date)
 MySQL Date. More...
 
static mySQLDateTime ($datetime)
 MySQL Date. More...
 
static stripSecondsFromTime ($time)
 
static daysToWeekStart ($date, $first_day= 'monday')
 Days number. More...
 
static beginningOfWeek ($date, $first_day= 'monday')
 
static compareDate ()
 TO DO. More...
 
static compareDatetime ()
 TO DO. More...
 
static formatFromFormat ($date, $deprecated= '', $to= 'm/d/Y H:i')
 Format a date time. More...
 
static makeTimeFrom ($format, $date)
 Timestamp from format. More...
 
static date2MySql ($date, $deprecated= '')
 Date for mySQL. More...
 
static dateTime2MySql ($datetime, $deprecated= '')
 Date and time for mySQL. More...
 
- Static Public Member Functions inherited from WPDKObject
static __delta ($last_version, $old_version)
 Object delta compare for combine. More...
 
static delta ($last_version, $old_version)
 
static __dump ($var, $monitor=false)
 Dump a variable. More...
 

Data Fields

const MYSQL_DATE = 'Y-m-d'
 MySQL date format. More...
 
const MYSQL_DATE_TIME = 'Y-m-d H:i:s'
 MySQL date time format. More...
 
 $__version = '1.0.2'
 Version. More...
 
- Data Fields inherited from WPDKObject
 $__version = '1.0.0'
 The version number assigned to the class. More...
 

Additional Inherited Members

- Public Member Functions inherited from WPDKObject
 __className ()
 Returns the class object. More...
 
 __parentClass ()
 Returns the class object for the receiver’s superclass. More...
 
 __isClass ($class)
 Brief. More...
 
 __isSubclassOfClass ($class)
 Return TRUE if the receiving class is a subclass of —or identical to— $class, otherwise FALSE. More...
 

Detailed Description

This class is useful to convert date and date time from a lot of format. It was design for MySQL conversion and jQuery date and datetime picker manage.

Author
=undo= info@.nosp@m.wpxt.nosp@m.re.me
Date
2014-01-08
Version
1.0.2

Definition at line 14 of file wpdk-datetime.php.

Member Function Documentation

static beginningOfWeek (   $date,
  $first_day = 'monday' 
)
static

Returns number of days to start of this week.

Author
=stid= s.fur.nosp@m.iosi.nosp@m.@wpxt.nosp@m.re.m.nosp@m.e
Parameters
string$date
string$first_dayOptional. Start from monday
Returns
int

Definition at line 244 of file wpdk-datetime.php.

static compareDate ( )
static

TO DO.

Definition at line 256 of file wpdk-datetime.php.

static compareDatetime ( )
static

TO DO.

Definition at line 261 of file wpdk-datetime.php.

static date2MySql (   $date,
  $deprecated = '' 
)
static

Date for mySQL.

Return any date/time in simple mySQL date format: YYYY-MM-DD

Deprecated:
since 1.3.0 use mySQLDate() instead
Parameters
string$dateDate
string$deprecatedOptional. Deprecated and not used since 1.0.0.b2
Returns
string Data nel formato YYYY-MM-DD

Definition at line 332 of file wpdk-datetime.php.

static dateTime2MySql (   $datetime,
  $deprecated = '' 
)
static

Date and time for mySQL.

Formatta una data e ora per essere inserita in mySQL, quindi in formato YYYY-MM-DD HH:MM:SS Return any date/time in simple mySQL date format: YYYY-MM-DD HH:MM:SS

Deprecated:
since 1.3.0 use mySQLDateTime() instead
Parameters
string$datetimeDate
string$deprecatedOptional. Deprecated and not used since 1.0.0.b2
Returns
string

Definition at line 353 of file wpdk-datetime.php.

static daysToDate (   $date)
static

Return the number of days to a expiration date.

Return the days to a expiration date from now. Return the days to up ($date > now) or days expired ($date < now).

Parameters
int$dateA timestamp date
Returns
float

Definition at line 88 of file wpdk-datetime.php.

static daysToWeekStart (   $date,
  $first_day = 'monday' 
)
static

Days number.

Returns number of days to start of this week.

Author
=stid= s.fur.nosp@m.iosi.nosp@m.@wpxt.nosp@m.re.m.nosp@m.e
Parameters
object$dateDate object
string$first_day
Returns
int $date

Definition at line 213 of file wpdk-datetime.php.

static expirationDate (   $date,
  $duration,
  $duration_type 
)
static

Return expiration timestamp date.

Return a timestamp as sum from $date and $duration/$duration_type

Parameters
string$dateStart date in MySQL format as YYYY-MM-DD HH:MM:SS
int$durationDuration
string$duration_typeType as days, minutes, `months
See Also
daysToDate()
Returns
int

Definition at line 73 of file wpdk-datetime.php.

static format (   $date,
  $to = 'm/d/Y H:i' 
)
static

Format a date time.

Format a date time in your custom own format. The source format is auto-detect.

Since
1.0.0
Parameters
string$dateSource date string format
string$toOptional. Destination/outout format, default m/d/Y H:i
Returns
string

Definition at line 50 of file wpdk-datetime.php.

static formatFromFormat (   $date,
  $deprecated = '',
  $to = 'm/d/Y H:i' 
)
static

Format a date time.

Format a date time. You can select a source format and destination format in order to return the right output for you.

Since
1.0.0.b2 Deprecated argument
Parameters
string$dateSource date string format
string$deprecatedOptional. Not used.
string$toDestination/outout format, default m/d/Y H:i
Deprecated:
Use format() instead
Returns
string

Definition at line 285 of file wpdk-datetime.php.

static isExpired (   $exipration)
static

Check if a date is expired.

Return TRUE if $expiration date is past

Parameters
int$exiprationTimestamp date to check
Returns
bool

Definition at line 116 of file wpdk-datetime.php.

static isInRangeDatetime (   $date_start,
  $date_expire,
  $format = 'YmdHis',
  $timestamp = false 
)
static

Check for date range.

Return TRUE if now (today) is between from two date.

Parameters
string | int$date_startStart date in string or timestamp.
string | int$date_expireExpire date in string or timestamp.
string$formatDate format for start and expire.
bool$timestampTRUE if the date are in timestamp format.
Returns
bool

Definition at line 133 of file wpdk-datetime.php.

static makeTimeFrom (   $format,
  $date 
)
static

Timestamp from format.

Return a timestamp from a specific format of date

Deprecated:
Since 1.0.0.b2 - Use strtotime() PHP function instead
Parameters
string$formatFormat
string$dateDate and time
Returns
int Timestamp

Definition at line 307 of file wpdk-datetime.php.

static mySQLDate (   $date)
static

MySQL Date.

Return a date in MySQL format YYYY-MM-DD.

Since
1.3.0
Parameters
string$dateA string date
Returns
string

Definition at line 169 of file wpdk-datetime.php.

static mySQLDateTime (   $datetime)
static

MySQL Date.

Return a date and time in MySQL format YYYY-MM-DD HH:MM:SS.

Since
1.3.0
Parameters
string$datetimeA string date
Returns
string

Definition at line 184 of file wpdk-datetime.php.

static stripSecondsFromTime (   $time)
static

Strip seconds from a date string (with time)

Parameters
string$timeTime in hh:mm:ss
Returns
string

Definition at line 196 of file wpdk-datetime.php.

static timeNewLine (   $datetime)
static

Utility per porre l'orario su una nuova riga. Aggiunge un tag br nello spazio tra la data e l'ora

Parameters
string$datetimeData e ora formattati in modo che lo spazio delimiti data e ora
Returns
string Data, tag br e ora

Definition at line 102 of file wpdk-datetime.php.

Field Documentation

string $__version = '1.0.2'

Version.

Override version

Definition at line 37 of file wpdk-datetime.php.

const MYSQL_DATE = 'Y-m-d'

MySQL date format.

This is the standard MySQL date format

Definition at line 21 of file wpdk-datetime.php.

const MYSQL_DATE_TIME = 'Y-m-d H:i:s'

MySQL date time format.

This is the standard MySQL date and time format

Definition at line 28 of file wpdk-datetime.php.


The documentation for this class was generated from the following file: