<?xml version="1.0"?><phpdoc><class name="Bs_Date" extends="Bs_Object" undoc="false" access="private" package="Date"><file>C:/usr/local/lib/php/blueshoes-4.2/core/date/Bs_Date.class.php</file><doc><author email="andrej@arn.li">andrej arn</author><inherited src="Array"/><description>This static class provides many useful date and time methods.This is new, untested code! please test the return values of the methods you&amp;apos;re goingto use... and make some comments in the methods you&amp;apos;ve used successfully. otherwise tell the author.there are the following ways to write dates and times:1) the unix timestampeg 982591823 for 2001-02-19 15:10:23some notes about the unix timestamp:This timestamp is a long integer containing the number of seconds between the Unix Epoch (January 1 1970)and the time specified.On systems where time_t is a 32bit signed integer, as most common today, the valid range for year is somewherebetween 1902 and 2037.Year may be a two or four digit value, with values between 0-69 mapping to 2000-2069 and 70-99 to 1970-1999.2) us datetimeeg 2001/02/19 15:10:23      (there is also mm.dd.yyyy and mm.dd.yy which makes it terrible.)3) eu datetimeeg 19.02.2001 15:10:234) sql datetimeeg 2001-02-19 15:10:235) sql timestampeg 200102191510236) mysql datetimeeg 2001-02-19 15:10:23  (actually mysql takes any special character instead of the &amp;apos;-&amp;apos;.)7) &amp;apos;array&amp;apos;array(&amp;apos;year&amp;apos;=&amp;gt;&amp;apos;2002&amp;apos;, &amp;apos;month&amp;apos;=&amp;gt;&amp;apos;12&amp;apos;, &amp;apos;day&amp;apos;=&amp;gt;&amp;apos;31&amp;apos;, &amp;apos;hour&amp;apos;=&amp;gt;&amp;apos;24&amp;apos;, &amp;apos;min&amp;apos;=&amp;gt;&amp;apos;59&amp;apos;, &amp;apos;sec&amp;apos;=&amp;gt;&amp;apos;59&amp;apos;);the values are stored as strings, not numbers. this way we can have &amp;apos;03&amp;apos; instead of &amp;apos;3&amp;apos; fora month for example.the problem starts when ppl type in 19.2.01 and things like that, or don&amp;apos;t use the expectedpunctuation like &amp;quot;.&amp;quot; for eu dates and &amp;quot;/&amp;quot; for us dates.while unix treats 0-69 as year 2000 and 70-99 as year 1900, we do it different here!0-29 is considered 2000 and 30-99 is considered 1999. (because of the birthdays).i think it happens way more often that someone has to type in a birthday and just types 10.3.45instead someone typing in 10.3.45 when he means an event on 10.3.2045. anyway... please be strictand don&amp;apos;t accept 2-digit year values from user input. reject it! this is only the fallback...todo: add functionality to let the user define the year-range himself (what is 1900 and what is2000).to make things easier, when converting from one date type to another, like from us to eu, weconvert it to a unix timestamp internally. this might be a problem for dates outside thetimestamp range (January 1 1970 - 2037) ... phew ... should we change this behavior? i think yes.dependencies: Bs_String</description><shortdescription>**********************************************************************</shortdescription><version>4.0.$id$</version><copyright>blueshoes.org</copyright></doc><function name="Bs_Date" undoc="false" access="public"><doc><return type="void"/><description/><shortdescription>constructor.</shortdescription></doc></function><function name="now" undoc="false" access="public"><doc><return name="" type="string">current datetime in us style.</return><description>this function is an alias for this-&amp;gt;formatUnixTimestamp(&amp;apos;us-1&amp;apos;)</description><shortdescription>returns the current datetime in us style.</shortdescription></doc></function><function name="formatUnixTimestamp" undoc="false" access="public"><doc><parameter name="$style" default="&amp;apos;eu-2&amp;apos;" type="string">how the datetime should be returned. getFormatForStyle(). default is &amp;apos;eu-2&amp;apos;.</parameter><parameter name="$unixTimestamp" default="NULL" type="string">(a unix timestamp or none. none means &amp;apos;use the current date/time&amp;apos;.)</parameter><return name="" type="string"/><description>this method uses getFormatForStyle().</description><shortdescription>returns a unix timestamp formatted as a datetime, eg 982591823 -&amp;gt; 19.02.2001 15:10:23.</shortdescription></doc></function><function name="formatArray" undoc="false" access="public"><doc><parameter name="$style" default="&amp;apos;eu-2&amp;apos;" type="string">how the datetime should be returned. getFormatForStyle(). default is &amp;apos;eu-2&amp;apos;.</parameter><parameter name="$array" default="NULL" type="string">(none means &amp;apos;use the current date/time&amp;apos;.)</parameter><return name="" type="string"/><description>this method uses getFormatForStyle().</description><shortdescription>returns a date-array formatted as a date, time or datetime.</shortdescription></doc></function><function name="getFormatForStyle" undoc="false" access="public"><doc><parameter name="$style" default="&amp;apos;eu-2&amp;apos;" type="string">(see above)</parameter><return name="" type="string"/><description>possible values for the $style param:&amp;apos;eu-1&amp;apos; -&amp;gt; dd.mm.yyyy hh:mm:ss&amp;apos;eu-2&amp;apos; -&amp;gt; dd.mm.yyyy hh:mm&amp;apos;eu-3&amp;apos; -&amp;gt; dd.mm.yyyy&amp;apos;eu-4&amp;apos; -&amp;gt; hh:mm:ss&amp;apos;eu-5&amp;apos; -&amp;gt; hh:mm&amp;apos;us-1&amp;apos; -&amp;gt; yyyy/mm/dd hh:mm:ss&amp;apos;us-2&amp;apos; -&amp;gt; yyyy/mm/dd hh:mm&amp;apos;us-3&amp;apos; -&amp;gt; yyyy/mm/dd&amp;apos;us-4&amp;apos; -&amp;gt; hh:mm:ss&amp;apos;us-5&amp;apos; -&amp;gt; hh:mm&amp;apos;sql-1&amp;apos; -&amp;gt; yyyy-mm-dd hh:mm:ss&amp;apos;sql-2&amp;apos; -&amp;gt; yyyy-mm-dd hh:mm&amp;apos;sql-3&amp;apos; -&amp;gt; yyyy-mm-dd&amp;apos;sql-4&amp;apos; -&amp;gt; hh:mm:ss&amp;apos;sql-5&amp;apos; -&amp;gt; hh:mm&amp;apos;ts-1&amp;apos;  -&amp;gt; yyyymmddhhmmss</description><shortdescription>takes a style definition and returns the format for it. see below.</shortdescription></doc></function><function name="formatUsDatetime" undoc="false" access="public"><doc><see type="function">formatUnixTimestamp()</see><parameter name="$style" default="&amp;apos;eu-2&amp;apos;" type="string">how the datetime should be returned. see below. default is &amp;apos;eu-2&amp;apos;.</parameter><parameter name="$usDatetime" default="NULL" type="string">a us datetime or none. none means &amp;apos;use the current date/time&amp;apos;.</parameter><return name="" type="string"/><description>this method makes use of formatUnixTimestamp(), so watch out for the $style options.</description><shortdescription>returns a us datetime formatted as any datetime, eg 1999/08/27 13:39:36 -&amp;gt; 27.08.1999 13:39:36</shortdescription></doc></function><function name="formatEuDatetime" undoc="false" access="public"><doc><see type="function">formatUnixTimestamp()</see><parameter name="$style" default="&amp;apos;eu-2&amp;apos;" type="string">how the datetime should be returned. see below. default is &amp;apos;eu-2&amp;apos;.</parameter><parameter name="$euDatetime" default="NULL" type="string">a eu datetime or none. none means &amp;apos;use the current date/time&amp;apos;.</parameter><return name="" type="string"/><description>this method makes use of formatUnixTimestamp(), so watch out for the $style options.</description><shortdescription>returns a eu datetime formatted as any datetime, eg 27.8.1999 13:39:36 -&amp;gt; 1999/08/27 13:39:36</shortdescription></doc></function><function name="formatSqlDatetime" undoc="false" access="public"><doc><see type="function">formatUnixTimestamp()</see><parameter name="$style" default="&amp;apos;eu-2&amp;apos;" type="string">how the datetime should be returned. see below. default is &amp;apos;eu-2&amp;apos;.</parameter><parameter name="$sqlDatetime" default="NULL" type="string">a sql datetime or none. none means &amp;apos;use the current date/time&amp;apos;.</parameter><return name="" type="string"/><description>this method makes use of formatUnixTimestamp(), so watch out for the $style options.</description><shortdescription>returns a sql datetime formatted as any datetime, eg 1999-08-27 13:39:36 -&amp;gt; 27.8.1999 13:39:36</shortdescription></doc></function><function name="formatSqlTimestamp" undoc="false" access="public"><doc><see type="function">formatUnixTimestamp()</see><parameter name="$style" default="&amp;apos;eu-2&amp;apos;" type="string">how the datetime should be returned. see below. default is &amp;apos;eu-2&amp;apos;.</parameter><parameter name="$sqlTimestamp" default="NULL" type="string">a sql timestamp or none. none means &amp;apos;use the current date/time&amp;apos;.</parameter><return name="" type="string"/><description>this method makes use of formatUnixTimestamp(), so watch out for the $style options.</description><shortdescription>returns a mysql timestamp formatted as a datetime, eg 19990827133936 -&amp;gt; 27.08.1999 13:39:36</shortdescription></doc></function><function name="sqlTimestampToUnixTimestamp" undoc="false" access="public"><doc><parameter name="$sqlTimestamp" type="string"/><return name="" type="string">unix timestamp&#x0a;this method required Bs_String.</return><description/><shortdescription>converts an sql timestamp into a unix timestamp. eg 20010219151023 -&amp;gt; 982591823</shortdescription></doc></function><function name="timeToUnixTimestamp" undoc="false" access="public"><doc><parameter name="$time" type="string"/><return name="" type="string">unix timestamp</return><description>this function gets used by usDateToUnixTimestamp(), euDateToUnixTimestamp(), sqlDateToUnixTimestamp()because the time looks the same in all of these versions (us, eu, sql).the day, month and year of the returned timestamp will be from the current date.we are using php&amp;apos;s built in strToTime(). hope it will get better... but should be ok for the time stuff.</description><shortdescription>converts a time into a unix timestamp. 15:10:23 -&amp;gt; 984665423</shortdescription></doc></function><function name="usDatetimeToUnixTimestamp" undoc="false" access="public"><doc><parameter name="$usDatetime" type="string"/><return name="" type="string">unix timestamp</return><description>we are using php&amp;apos;s built in strToTime(). hope it will get better...</description><shortdescription>converts a us datetime into a unix timestamp. eg 2001/02/19 15:10:23 -&amp;gt; 982591823</shortdescription></doc></function><function name="usDateToUnixTimestamp" undoc="false" access="public"><doc><parameter name="$usDate" type="string"/><return name="" type="string">unix timestamp</return><description>we are using php&amp;apos;s built in strToTime(). hope it will get better...</description><shortdescription>converts a us date into a unix timestamp. eg 2001/02/19 -&amp;gt;</shortdescription></doc></function><function name="usTimeToUnixTimestamp" undoc="false" access="public"><doc><see type="function">timeToUnixTimestamp()</see><parameter name="$usTime" type="string"/><return name="" type="string">unix timestamp</return><description>because the time looks the same in all versions (us, eu, sql) all these methods are using timeToUnixTimestamp().</description><shortdescription>converts a us time into a unix timestamp. 15:10:23 -&amp;gt;</shortdescription></doc></function><function name="sqlDatetimeToUnixTimestamp" undoc="false" access="public"><doc><parameter name="$sqlDatetime" type="string"/><return name="" type="string">unix timestamp</return><throws>-1</throws><description>we are using php&amp;apos;s built in strToTime(). hope it will get better...</description><shortdescription>converts a sql datetime into a unix timestamp. eg 2001-02-19 15:10:23 -&amp;gt; 982591823</shortdescription></doc></function><function name="sqlDateToUnixTimestamp" undoc="false" access="public"><doc><parameter name="$sqlDate" type="string"/><return name="" type="string">unix timestamp</return><throws>bool false</throws><description>we are using php&amp;apos;s built in strToTime(). hope it will get better...</description><shortdescription>converts a sql date into a unix timestamp. eg 2001-02-19 -&amp;gt;</shortdescription></doc></function><function name="sqlTimeToUnixTimestamp" undoc="false" access="public"><doc><see type="function">timeToUnixTimestamp()</see><parameter name="$sqlTime" type="string"/><return name="" type="string">unix timestamp</return><description>because the time looks the same in all versions (us, eu, sql) all these methods are using timeToUnixTimestamp().</description><shortdescription>converts a sql time into a unix timestamp. 15:10:23 -&amp;gt;</shortdescription></doc></function><function name="euDatetimeToUnixTimestamp" undoc="false" access="public"><doc><parameter name="$euDatetime" type="string"/><return name="" type="string">unix timestamp</return><description>we are NOT using php&amp;apos;s built in strToTime() because it returns wrong dates for eu dates :(at least until now, 2001/02/20. hope it will improve. so we use some own php code.for the date part, we use our own euDateToUnixTimestamp() method. then we create a us date withformatUnixTimestamp(). finally we convert the us date together with the time part to a timestampusing usDatetimeToUnixTimestamp().i have tested it and a) performance is definitely NOT an issue, and b) it works quite well, evenwith a date like &amp;quot;15.3.1999  10:26:10&amp;quot; (note the extra spaces in the middle).</description><shortdescription>converts a eu datetime into a unix timestamp. eg 19.2.2001 15:10:23 -&amp;gt; 982591823</shortdescription></doc></function><function name="euDateToArray" undoc="false" access="public"><doc><see type="function">sqlDateToArray()</see><parameter name="$euDate" type="string">(31.12.2002)</parameter><return name="" type="array"/><throws>bool FALSE (not a valid date. eg wrong syntax</throws><throws>or 31.03.2002)</throws><description>this method does not use the unix-timestamp, so there is no limitation in the time range.</description><shortdescription>converts a eu date into an array.</shortdescription></doc></function><function name="sqlDateToArray" undoc="false" access="public"><doc><see type="function">euDateToArray()</see><parameter name="$sqlDate" type="string">(2002-12-31)</parameter><return name="" type="array"/><throws>bool FALSE (not a valid date. eg wrong syntax</throws><throws>or 2002-03-31)</throws><description>this method does not use the unix-timestamp, so there is no limitation in the time range.</description><shortdescription>converts a sql date into an array.</shortdescription></doc></function><function name="getSeparator" undoc="false" access="public"><doc><parameter name="$date" type="string"/><return name="" type="string"> (char)</return><throws>bool FALSE (nothing found)</throws><description>example: 2002/12/31 =&amp;gt; /31.12.2002 =&amp;gt; .</description><shortdescription>tries to find the separator used in a date.</shortdescription></doc></function><function name="cleanDateArray" undoc="false" access="public"><doc><parameter name="$arr" type="array">(hash)</parameter><return name="" type="array"> (hash)</return><description>if these keys don&amp;apos;t exist, they&amp;apos;ll be added:&amp;apos;year&amp;apos;, &amp;apos;month&amp;apos;, &amp;apos;day&amp;apos;, &amp;apos;hour&amp;apos;, &amp;apos;min&amp;apos;, &amp;apos;sec&amp;apos;</description><shortdescription>takes a date array and cleans its elements.</shortdescription></doc></function><function name="euDateToUnixTimestamp" undoc="false" access="public"><doc><parameter name="$euDate" type="string"/><return name="" type="string">unix timestamp</return><description>we are NOT using php&amp;apos;s built in strToTime() because it returns wrong dates for eu dates :(at least until now, 2001/02/20. hope it will improve. so we use some own php code.</description><shortdescription>converts a eu date into a unix timestamp. eg 19.2.2001 -&amp;gt; 982591823</shortdescription></doc></function><function name="euTimeToUnixTimestamp" undoc="false" access="public"><doc><see type="function">timeToUnixTimestamp()</see><parameter name="$euTime" type="string"/><return name="" type="string">unix timestamp</return><description>because the time looks the same in all versions (us, eu, sql) all these methods are using timeToUnixTimestamp().</description><shortdescription>converts a eu time into a unix timestamp. 15:10:23 -&amp;gt;</shortdescription></doc></function><function name="usDatetimeToEuDatetime" undoc="false" access="public"><doc><parameter name="$usDatetime" default="&amp;apos;&amp;apos;" type="string"/><return name="" type="string">eu datetime</return><description/><shortdescription>converts a us datetime into a european datetime</shortdescription></doc></function><function name="usDateToEuDate" undoc="false" access="public"><doc><parameter name="$usDate" default="&amp;apos;&amp;apos;" type="string"/><return name="" type="string">eu date</return><throws>bs_exception or -1</throws><throws>both is possible.</throws><description/><shortdescription>converts a us date into a european date</shortdescription></doc></function><function name="usDatetimeToSqlDatetime" undoc="false" access="public"><doc><parameter name="$usDatetime" default="&amp;apos;&amp;apos;" type="string"/><return name="" type="string">sql datetime</return><description/><shortdescription>converts a us datetime into a sql datetime</shortdescription></doc></function><function name="usDateToSqlDate" undoc="false" access="public"><doc><parameter name="$usDate" default="&amp;apos;&amp;apos;" type="string"/><return name="" type="string">sql date</return><description/><shortdescription>converts a us date into a sql date</shortdescription></doc></function><function name="euDatetimeToUsDatetime" undoc="false" access="public"><doc><parameter name="$euDatetime" default="&amp;apos;&amp;apos;" type="string"/><return name="" type="string">us datetime</return><description/><shortdescription>converts a eu datetime into a us datetime</shortdescription></doc></function><function name="euDateToUsDate" undoc="false" access="public"><doc><parameter name="$euDate" default="&amp;apos;&amp;apos;" type="string"/><return name="" type="string">us date</return><description/><shortdescription>converts a eu date into a us date</shortdescription></doc></function><function name="euDatetimeToSqlDatetime" undoc="false" access="public"><doc><parameter name="$euDatetime" default="&amp;apos;&amp;apos;" type="string"/><return name="" type="string">sql datetime</return><description/><shortdescription>converts a eu datetime into a sql datetime</shortdescription></doc></function><function name="euDateToSqlDate" undoc="false" access="public"><doc><parameter name="$euDate" default="&amp;apos;&amp;apos;" type="string"/><return name="" type="string">sql date</return><description/><shortdescription>converts a eu date into a sql date</shortdescription></doc></function><function name="sqlDatetimeToUsDatetime" undoc="false" access="public"><doc><parameter name="$sqlDatetime" default="&amp;apos;&amp;apos;" type="string"/><return name="" type="string">us datetime</return><description/><shortdescription>converts a sql datetime into a us datetime eg &amp;apos;2001-02-28 20:54:23&amp;apos; -&amp;gt; &amp;apos;2001/02/28 20:54:23&amp;apos;</shortdescription></doc></function><function name="sqlDateToUsDate" undoc="false" access="public"><doc><parameter name="$sqlDate" default="&amp;apos;&amp;apos;" type="string"/><return name="" type="string">us date</return><description/><shortdescription>converts a sql date into a us date</shortdescription></doc></function><function name="sqlDatetimeToEuDatetime" undoc="false" access="public"><doc><parameter name="$sqlDatetime" type="string"/><return name="" type="string">eu datetime</return><description/><shortdescription>converts a sql datetime into a european datetime</shortdescription></doc></function><function name="sqlDateToEuDate" undoc="false" access="public"><doc><parameter name="$sqlDate" default="&amp;apos;&amp;apos;" type="string"/><return name="" type="string">eu date</return><description/><shortdescription>converts a sql date into a eu date</shortdescription></doc></function><function name="monthStringToNumber" undoc="false" access="public"><doc><parameter name="$month" type="string"/><parameter name="$zeroFill" default="FALSE" type="string">if set to TRUE, the return value is a 2 char string. default is FALSE.</parameter><return name="" type="mixed"> (int 1 to 12 or string &amp;apos;01&amp;apos; to &amp;apos;12&amp;apos; depending on $zeroFill)</return><throws>int 0 (if not known</throws><throws>no match. does *not* return &amp;apos;00&amp;apos; if $zeroFill is TRUE.)</throws><description>takes the param $month in the languages:- english en     - danish     da- french  fr     - italian    it- german  de     - spanish    es- dutch   nl     - portuguese ptyou don&amp;apos;t need to &amp;quot;normalize&amp;quot; strings, eg &amp;apos;février&amp;apos; to &amp;apos;fevrier&amp;apos;.for details see db-table bs_kb.LangMonth.</description><shortdescription>converts a month like &amp;apos;Feb&amp;apos; or &amp;apos;February&amp;apos; into a numerical month value (2).</shortdescription></doc></function><function name="monthToInt" undoc="false" access="private"><doc><parameter name="$month" undoc="true"/><parameter name="$zeroFill" type="string" undoc="true"/><return type="void"/><description/><shortdescription>use monthStringToNumber instead.</shortdescription></doc></function><function name="monthNumberToString" undoc="false" access="private"><doc><parameter name="$month" type="int"/><parameter name="$lang" default="&amp;apos;en&amp;apos;" type="string">the iso-code, default is &amp;apos;en&amp;apos;. see above.</parameter><parameter name="$type" default="&amp;apos;long&amp;apos;" type="string">one of &amp;apos;long&amp;apos; (default) or &amp;apos;short&amp;apos;.</parameter><return name="" type="string"/><throws>bool FALSE</throws><description>the following languages are supported: enexample:$month = monthNumberToString(12);                      //returns &amp;apos;December&amp;apos;$month = monthNumberToString(12, &amp;apos;en&amp;apos;, $type=&amp;apos;short&amp;apos;); //returns &amp;apos;Dec&amp;apos;</description><shortdescription>converts a numerical month value to a string.</shortdescription></doc></function><variable name="$_Bs_String" access="private" type="unknown"><doc><description/><shortdescription>reference to the global pseudostatic Bs_String object.</shortdescription></doc></variable><constant name="BS_DATE_VERSION" undoc="true" access="private" case="default: case sensitive">4.0.$x$<doc></doc></constant><inherited src="Bs_Object" type="functions"><element>isex</element><element>isexception</element><element>tostring</element><element>tohtml</element><element>persist</element><element>unpersist</element><element>bs_object</element><element>bbsetoutput</element><element>bbawake</element><element>bbisawake</element><element>bbxmsg</element><element>bbxfunctionstart</element><element>bbxfunctionend</element><element>bbxecho</element><element>bbxvar</element><element>bbxvardump</element><element>bbforcetrace</element><element>bbbufferstart</element><element>bbbufferget</element><element>bbbufferendflush</element><element>bbbufferendclean</element></inherited><inherited src="Bs_Object" type="consts"><element>bs_object_version</element></inherited><path><parent>Bs_Object</parent></path><baseclass>Bs_Object</baseclass></class></phpdoc>