Docs Home

sb.date

@File: /surebert/date.js

@Description: A constructor used to format date strings, based on PHP date function


@Param: integer timestamp A unix timestamp to specify a date other than now
@Returns: sb.date object with the follwoing properties
@Example:
 
//create a sb.date object of the current date/time
var myDate = new sb.date();

//create a sb.date object of another date/time by unixtimestamp
var myDate = new sb.date(1174337641);

//alerts the minute of the date object
alert(myDate.i);

//alerts a formatted date string based on your date object
var myDate = new sb.date();
alert(myDate.format('/m/d/y H:i:s');

sb.date.prototype.format

@File: /surebert/date.js

@Description: Can be used on any sb.date insatnce to return another formatted date string. See formatting options in sb.date.


@Param: String format The string format of the desired date format
@Param: String timestamp A unix timestamp to specify a date other than now
@Example:
 
    //get a formatted date string of the current date/time
    var myDate = new sb.date('m/d/y H:i:s');
    //myDate.toString = 10/29/06 01:41:33

    //use the format method of the instance to switch date formats
    myDate.format('d/m/y');