Webylon 3.1 API Docs
  • Package
  • Class
  • Tree
  • Deprecated
  • Download
Version: current
  • 3.2
  • 3.1

Packages

  • auth
  • Booking
  • cart
    • shipping
    • steppedcheckout
  • Catalog
  • cms
    • assets
    • batchaction
    • batchactions
    • bulkloading
    • comments
    • content
    • core
    • export
    • newsletter
    • publishers
    • reports
    • security
    • tasks
  • Dashboard
  • DataObjectManager
  • event
  • faq
  • forms
    • actions
    • core
    • fields-basic
    • fields-dataless
    • fields-datetime
    • fields-files
    • fields-formatted
    • fields-formattedinput
    • fields-relational
    • fields-structural
    • transformations
    • validators
  • googlesitemaps
  • guestbook
  • installer
  • newsletter
  • None
  • photo
    • gallery
  • PHP
  • polls
  • recaptcha
  • sapphire
    • api
    • bulkloading
    • control
    • core
    • cron
    • dev
    • email
    • fields-formattedinput
    • filesystem
    • formatters
    • forms
    • i18n
    • integration
    • misc
    • model
    • parsers
    • search
    • security
    • tasks
    • testing
    • tools
    • validation
    • view
    • widgets
  • seo
    • open
      • graph
  • sfDateTimePlugin
  • spamprotection
  • stealth
    • captha
  • subsites
  • userform
    • pagetypes
  • userforms
  • webylon
  • widgets

Classes

  • sfDate
  • sfDateTimeToolkit
  • sfTime

Class sfTime

sfTime class.

A library for manipulating dates in symfony (php).

Package: sfDateTimePlugin
Author: Stephen Riesenberg <sjohnr@gmail.com>
Version: SVN: $Id$
Located at calendar_base/code/sfTime.class.php

Methods summary

public static timestamp
# add( timestamp $ts = null, integer $num = 1, integer $unit = sfTime::DAY )

Adds the specified number of given units of time to the given date.

Adds the specified number of given units of time to the given date.

Example:

// tomorrow
$dt = sfTime::add();
// day after
$dt = sfTime::add($mydate);
// 5 days after
$dt = sfTime::add($mydate, 5);
// 2 months after
$dt = sfTime::add($mydate, 2, sfTime::MONTH);
// 4 weeks after
$dt = sfTime::add($mydate, 4, sfTime::WEEK);

Parameters

$ts
timestamp a timestamp for the calculation
$num
int the number of units to add to the given date
$unit
int the unit to add by

Returns

timestamp
the timestamp result of the calculation

Throws

sfDateTimeException
sfDateTimeException
public static timestamp
# subtract( timestamp $ts = null, integer $num = 1, integer $unit = sfTime::DAY )

Subtracts the specified number of given units of time from the given date.

Subtracts the specified number of given units of time from the given date.

Example:

// yesterday
$dt = sfTime::subtract();
// day before
$dt = sfTime::subtract($mydate);
// 5 days before
$dt = sfTime::subtract($mydate, 5);
// 2 months before
$dt = sfTime::subtract($mydate, 2, sfTime::MONTH);
// 4 weeks before
$dt = sfTime::subtract($mydate, 4, sfTime::WEEK);

Parameters

$ts
timestamp a timestamp for the calculation
$num
int the number of units to add to the given date
$unit
int the unit to add by

Returns

timestamp
the timestamp result of the calculation

See

sfTime::add()
public static timestamp
# clearTime( timestamp $ts = null )

Returns the timestamp with the date but without the time of day.

Returns the timestamp with the date but without the time of day.

Parameters

$ts
timestamp

Returns

timestamp
timestamp
public static timestamp
# clearDate( timestamp $ts = null )

Returns the timestamp with the time of day but without the date.

Returns the timestamp with the time of day but without the date.

Deprecated

This is a deprecated function. Do not use!

Parameters

$ts
timestamp

Returns

timestamp
timestamp
public static timestamp
# clearSecond( timestamp $ts = null )

Clear the second value of this timestamp.

Clear the second value of this timestamp.

Parameters

$ts
timestamp

Returns

timestamp
timestamp
public static timestamp
# clearMinute( timestamp $ts = null )

Clear the minute value of this timestamp.

Clear the minute value of this timestamp.

Parameters

$ts
timestamp

Returns

timestamp
timestamp
public static timestamp
# clearHour( timestamp $ts = null )

Clear the hour value of this timestamp.

Clear the hour value of this timestamp.

Parameters

$ts
timestamp

Returns

timestamp
timestamp
public static timestamp
# setSecond( timestamp $ts = null, integer $second = 0 )

Set the second value of this timestamp.

Set the second value of this timestamp.

Parameters

$ts
timestamp
$second
int

Returns

timestamp
timestamp
public static timestamp
# setMinute( timestamp $ts = null, integer $minute = 0 )

Set the minute value of this timestamp.

Set the minute value of this timestamp.

Parameters

$ts
timestamp
$minute
int

Returns

timestamp
timestamp
public static timestamp
# setHour( timestamp $ts = null, integer $hour = 0 )

Set the hour value of this timestamp.

Set the hour value of this timestamp.

Parameters

$ts
timestamp
$hour
int

Returns

timestamp
timestamp
public static timestamp
# setDay( timestamp $ts = null, integer $day = 1 )

Set the day value of this timestamp.

Set the day value of this timestamp.

Parameters

$ts
timestamp
$day
int

Returns

timestamp
timestamp
public static timestamp
# setMonth( timestamp $ts = null, integer $month = 1 )

Set the month value of this timestamp.

Set the month value of this timestamp.

Parameters

$ts
timestamp
$month
int

Returns

timestamp
timestamp
public static timestamp
# setYear( timestamp $ts = null, integer $year = 1970 )

Set the year value of this timestamp.

Set the year value of this timestamp.

Parameters

$ts
timestamp
$year
int

Returns

timestamp
timestamp
public static timestamp
# tomorrow( timestamp $ts = null )

Returns the timestamp for tomorrow.

Returns the timestamp for tomorrow.

Alias for sfTime::addDay

Parameters

$ts
timestamp

Returns

timestamp
timestamp
public static timestamp
# yesterday( timestamp $ts = null )

Returns the timestamp for yesterday.

Returns the timestamp for yesterday.

Alias for sfTime::subtractDay

Parameters

$ts
timestamp

Returns

timestamp
timestamp
public static timestamp
# addSecond( timestamp $ts = null, integer $num = 1 )

Adds the specified number of seconds to the timestamp.

Adds the specified number of seconds to the timestamp.

Parameters

$ts
timestamp
$num
int

Returns

timestamp
timestamp
public static timestamp
# subtractSecond( timestamp $ts = null, integer $num = 1 )

Subtracts the specified number of seconds from the timestamp.

Subtracts the specified number of seconds from the timestamp.

Parameters

$ts
timestamp
$num
int

Returns

timestamp
timestamp
public static timestamp
# addMinute( timestamp $ts = null, integer $num = 1 )

Adds the specified number of minutes to the timestamp.

Adds the specified number of minutes to the timestamp.

Parameters

$ts
timestamp
$num
int

Returns

timestamp
timestamp
public static timestamp
# subtractMinute( timestamp $ts = null, integer $num = 1 )

Subtracts the specified number of minutes from the timestamp.

Subtracts the specified number of minutes from the timestamp.

Parameters

$ts
timestamp
$num
int

Returns

timestamp
timestamp
public static timestamp
# addHour( timestamp $ts = null, integer $num = 1 )

Adds the specified number of hours to the timestamp.

Adds the specified number of hours to the timestamp.

Parameters

$ts
timestamp
$num
int

Returns

timestamp
timestamp
public static timestamp
# subtractHour( timestamp $ts = null, integer $num = 1 )

Subtracts the specified number of hours from the timestamp.

Subtracts the specified number of hours from the timestamp.

Parameters

$ts
timestamp
$num
int

Returns

timestamp
timestamp
public static timestamp
# addDay( timestamp $ts = null, integer $num = 1 )

Adds the specified number of days to the timestamp.

Adds the specified number of days to the timestamp.

Parameters

$ts
timestamp
$num
int

Returns

timestamp
timestamp
public static timestamp
# subtractDay( timestamp $ts = null, integer $num = 1 )

Subtracts the specified number of days from the timestamp.

Subtracts the specified number of days from the timestamp.

Parameters

$ts
timestamp
$num
int

Returns

timestamp
timestamp
public static timestamp
# addWeek( timestamp $ts = null, integer $num = 1 )

Adds the specified number of weeks to the timestamp.

Adds the specified number of weeks to the timestamp.

Parameters

$ts
timestamp
$num
int

Returns

timestamp
timestamp
public static timestamp
# subtractWeek( timestamp $ts = null, integer $num = 1 )

Subtracts the specified number of weeks from the timestamp.

Subtracts the specified number of weeks from the timestamp.

Parameters

$ts
timestamp
$num
int

Returns

timestamp
timestamp
public static timestamp
# addMonth( timestamp $ts = null, integer $num = 1 )

Adds the specified number of months to the timestamp.

Adds the specified number of months to the timestamp.

Parameters

$ts
timestamp
$num
int

Returns

timestamp
timestamp
public static timestamp
# subtractMonth( timestamp $ts = null, integer $num = 1 )

Subtracts the specified number of months from the timestamp.

Subtracts the specified number of months from the timestamp.

Parameters

$ts
timestamp
$num
int

Returns

timestamp
timestamp
public static timestamp
# addQuarter( timestamp $ts = null, integer $num = 1 )

Adds the specified number of quarters to the timestamp.

Adds the specified number of quarters to the timestamp.

Parameters

$ts
timestamp
$num
int

Returns

timestamp
timestamp
public static timestamp
# subtractQuarter( timestamp $ts = null, integer $num = 1 )

Subtracts the specified number of quarters from the timestamp.

Subtracts the specified number of quarters from the timestamp.

Parameters

$ts
timestamp
$num
int

Returns

timestamp
timestamp
public static timestamp
# addYear( timestamp $ts = null, integer $num = 1 )

Adds the specified number of years to the timestamp.

Adds the specified number of years to the timestamp.

Parameters

$ts
timestamp
$num
int

Returns

timestamp
timestamp
public static timestamp
# subtractYear( timestamp $ts = null, integer $num = 1 )

Subtracts the specified number of years from the timestamp.

Subtracts the specified number of years from the timestamp.

Parameters

$ts
timestamp
$num
int

Returns

timestamp
timestamp
public static timestamp
# addDecade( timestamp $ts = null, integer $num = 1 )

Adds the specified number of decades to the timestamp.

Adds the specified number of decades to the timestamp.

Parameters

$ts
timestamp
$num
int

Returns

timestamp
timestamp
public static timestamp
# subtractDecade( timestamp $ts = null, integer $num = 1 )

Subtracts the specified number of decades from the timestamp.

Subtracts the specified number of decades from the timestamp.

Parameters

$ts
timestamp
$num
int

Returns

timestamp
timestamp
public static timestamp
# addCentury( timestamp $ts = null, integer $num = 1 )

Adds the specified number of centuries to the timestamp.

Adds the specified number of centuries to the timestamp.

Parameters

$ts
timestamp
$num
int

Returns

timestamp
timestamp
public static timestamp
# subtractCentury( timestamp $ts = null, integer $num = 1 )

Subtracts the specified number of centuries from the timestamp.

Subtracts the specified number of centuries from the timestamp.

Parameters

$ts
timestamp
$num
int

Returns

timestamp
timestamp
public static timestamp
# addMillenium( timestamp $ts = null, integer $num = 1 )

Adds the specified number of millenia to the timestamp.

Adds the specified number of millenia to the timestamp.

Parameters

$ts
timestamp
$num
int

Returns

timestamp
timestamp
public static timestamp
# subtractMillenium( timestamp $ts = null, integer $num = 1 )

Subtracts the specified number of millenia from the timestamp.

Subtracts the specified number of millenia from the timestamp.

Parameters

$ts
timestamp
$num
int

Returns

timestamp
timestamp
public static timestamp
# firstDayOfWeek( timestamp $ts = null )

Returns the timestamp for first day of the week for the given date.

Returns the timestamp for first day of the week for the given date.

Parameters

$ts
timestamp

Returns

timestamp
timestamp
public static timestamp
# finalDayOfWeek( timestamp $ts = null )

Returns the timestamp for last day of the week for the given date.

Returns the timestamp for last day of the week for the given date.

Parameters

$ts
timestamp

Returns

timestamp
timestamp
public static timestamp
# firstDayOfMonth( timestamp $ts = null )

Returns the timestamp for first day of the month for the given date.

Returns the timestamp for first day of the month for the given date.

Parameters

$ts
timestamp

Returns

timestamp
timestamp
public static timestamp
# finalDayOfMonth( timestamp $ts = null )

Returns the timestamp for last day of the month for the given date.

Returns the timestamp for last day of the month for the given date.

Parameters

$ts
timestamp

Returns

timestamp
timestamp
public static timestamp
# firstDayOfQuarter( timestamp $ts = null )

Returns the timestamp for first day of thequarter for the given date.

Returns the timestamp for first day of thequarter for the given date.

NOTE: Computes the quarter as:

$quarter = ceil(date('m', $ts) / 3); // 1 - 4

Parameters

$ts
timestamp

Returns

timestamp
timestamp
public static timestamp
# finalDayOfQuarter( timestamp $ts = null )

Returns the timestamp for last day of the quarter for the given date.

Returns the timestamp for last day of the quarter for the given date.

Parameters

$ts
timestamp

Returns

timestamp
timestamp
public static timestamp
# firstDayOfYear( timestamp $ts = null )

Returns the timestamp for first day of the year for the given date.

Returns the timestamp for first day of the year for the given date.

Parameters

$ts
timestamp

Returns

timestamp
timestamp
public static timestamp
# finalDayOfYear( timestamp $ts = null )

Returns the timestamp for last day of the year for the given date.

Returns the timestamp for last day of the year for the given date.

Parameters

$ts
timestamp

Returns

timestamp
timestamp
public static timestamp
# nextDay( timestamp $ts = null, integer $day = sfTime::SUNDAY )

Returns the timestamp for the next occurance of [day].

Returns the timestamp for the next occurance of [day].

Parameters

$ts
timestamp
$day
int the day of week

Returns

timestamp
timestamp
public static timestamp
# previousDay( timestamp $ts = null, integer $day = sfTime::SUNDAY )

Returns the timestamp for the most recent (previous) occurance of [day].

Returns the timestamp for the most recent (previous) occurance of [day].

Parameters

$ts
timestamp
$day
int the day of week

Returns

timestamp
timestamp
public static timestamp
# nextMonth( timestamp $ts = null, integer $month = sfTime::JANUARY )

Returns the timestamp for the next occurance of [month].

Returns the timestamp for the next occurance of [month].

Parameters

$ts
timestamp
$month
int the month of year

Returns

timestamp
timestamp
public static timestamp
# previousMonth( timestamp $ts = null, integer $month = sfTime::JANUARY )

Returns the timestamp for the most recent (previous) occurance of [month].

Returns the timestamp for the most recent (previous) occurance of [month].

Parameters

$ts
timestamp
$month
int the month of year

Returns

timestamp
timestamp

Magic methods summary

Constants summary

integer SECOND 0
#

Units of time

Units of time

integer MINUTE 1
#
integer HOUR 2
#
integer DAY 3
#
integer WEEK 4
#
integer MONTH 5
#
integer QUARTER 6
#
integer YEAR 7
#
integer DECADE 8
#
integer CENTURY 9
#
integer MILLENIUM 10
#
integer MONDAY 1
#

Days of the week

Days of the week

integer TUESDAY 2
#
integer WEDNESDAY 3
#
integer THURSDAY 4
#
integer FRIDAY 5
#
integer SATURDAY 6
#
integer SUNDAY 7
#
integer JANUARY 1
#

Months of the year

Months of the year

integer FEBRUARY 2
#
integer MARCH 3
#
integer APRIL 4
#
integer MAY 5
#
integer JUNE 6
#
integer JULY 7
#
integer AUGUST 8
#
integer SEPTEMBER 9
#
integer OCTOBER 10
#
integer NOVEMBER 11
#
integer DECEMBER 12
#
[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -
Webylon 3.1 API Docs API documentation generated by ApiGen 2.8.0