[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Phpgroupware-developers] minor patch for mssql
From: |
Michael Dean |
Subject: |
Re: [Phpgroupware-developers] minor patch for mssql |
Date: |
14 Dec 2001 07:55:13 -0600 |
This has been applied. BTW, the FreeTDS seems to format dates a bit
differently than the native M$ and Sybase drivers. Those drivers spew
out English dates with text and are not guaranteed parseable. So, if
the seconds are being chopped off, I'd point the finger at FreeTDS.
Mike
On Thu, 2001-12-13 at 20:54, Bradley Bell wrote:
> rather simplistic, but it works!
>
> however, no matter how you implement these functions, it won't be perfect
> because MSSQL doesn't return the number of seconds when I select a
> datetime value! Perhaps it's a freetds issue, I'm not sure.
>
> e.g.:
> $UnixTime = 1008295135; // 2001-12-13 17:58:55
> $this->db->query("insert into foo (date) values
> ('".$db->to_timestamp($UnixTime)."')");
> $this->db->query("select date from foo");
> while ($this->db->next_record()) {
> $date = $this->db->from_timestamp($this->db->f('date'));
> printf("Date: %s\n", $date);
> }
>
> will output:
> Date: 1008295080
>
> which is equal to: 2001-12-13 17:58:00
>
> -brad
>
> Index: phpgwapi/inc/class.db_mssql.inc.php
> ===================================================================
> RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.db_mssql.inc.php,v
> retrieving revision 1.19
> diff -u -r1.19 class.db_mssql.inc.php
> --- phpgwapi/inc/class.db_mssql.inc.php 2001/12/13 00:50:21 1.19
> +++ phpgwapi/inc/class.db_mssql.inc.php 2001/12/14 02:15:27
> @@ -99,15 +100,14 @@
> return $this->Query_ID;
> }
>
> - // I don't have access to M$-SQL, can someone finish these 2
> functions ? (jengo)
> function to_timestamp($epoch)
> {
> - return False;
> + return date('Y-m-d H:i:s',$epoch);
> }
>
> function from_timestamp($timestamp)
> {
> - return False;
> + return strtotime($timestamp);
> }
>
> // public: perform a query with limited result set
>
> --
> Bradley Bell
> Computer Support Analyst
> University of Washington
> Classroom Support Services
>
> _______________________________________________
> Phpgroupware-developers mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/phpgroupware-developers