Difference between revisions of "DATEPART"

From AgileApps Support Wiki
imported>Aeric
imported>Aeric
Line 1: Line 1:
The DATEPART function returns a date/time value that is normalized to the start of the day, for use in comparisons with other date/time values.  
The DATEPART function returns a date/time value that is normalized to the start of the day, for use in comparisons with other date/time values.  


To get a string that contains the date only, use:
To get a string that contains the date only, use something like this:
:<syntaxhighlight lang="java" enclose="div">
:<syntaxhighlight lang="java" enclose="div">
TEXT(MONTH(date_modified))+'/'+TEXT(DAY(date_modified))+'/'+TEXT(YEAR(date_modified))   
TEXT(MONTH(date_modified))+'/'+TEXT(DAY(date_modified))+'/'+TEXT(YEAR(date_modified))   

Revision as of 21:43, 8 February 2012

The DATEPART function returns a date/time value that is normalized to the start of the day, for use in comparisons with other date/time values.

To get a string that contains the date only, use something like this:

<syntaxhighlight lang="java" enclose="div">

TEXT(MONTH(date_modified))+'/'+TEXT(DAY(date_modified))+'/'+TEXT(YEAR(date_modified)) </syntaxhighlight>

Syntax
<syntaxhighlight lang="java" enclose="div">

DATEPART('dString')) </syntaxhighlight>

Return
A date in the format defined by Date Format
Examples
<syntaxhighlight lang="java" enclose="div">

DATEPART('04/22/2009 03:15 am') ='04/22/2009 12:00:00 AM'

DATEPART(DATE ('2009', '04', '22', '03', '15', '00')) ='04/22/2009 12:00:00 AM' </syntaxhighlight>