Skip to content

Commit

Permalink
Item12968: fix d2n for MS-SQL
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk/DBIStoreContrib@17822 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
CrawfordCurrie authored and CrawfordCurrie committed Jul 18, 2014
1 parent bf0ea85 commit edf039e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/Foswiki/Contrib/DBIStoreContrib/Personality/ODBC.pm
Expand Up @@ -115,6 +115,15 @@ sub strcat {
return join( '+', @_ );
}

sub d2n {
my ( $this, $arg ) = @_;

# Convert date string to number
# 22088800 = number of seconds from 1900-01-01 to start of epoch
# 86400 = number of seconds in a day
return "(CAST(CONVERT(datetime, $arg) AS FLOAT) * 86400 - 22088800)";
}

1;
__DATA__
Expand Down

0 comments on commit edf039e

Please sign in to comment.