SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Trying to Make a XML field that displays DateTime in "TimeOnly" format but for some reason, I can't work it how to use it, as there isn't no "TimeOnly" property shown in Intellisense when i type the following code.

  <Field ID="{GUID id}"
    Type ="DateTime"
    Format ="TimeOnly"

The error i get is

The "Format" attribute is invalid - The value 'TimeOnly' is invalid according to its datatype "http:/" - The Enumeration contraint failed.

share|improve this question Here it says we can use this property format, dunno whats wrong tho – Muhammad Raja Mar 12 '12 at 12:03
up vote 1 down vote accepted

SharePoint stores Time information in Universal Time Code format (UTC) which means there is no way to store the time without the date. There are ways to configure the display of a column in things like a DataView Web part to only display the time. Or you could create a calculated column that will store a string representation of the just the time. But there is no way to store just the time.

For date/time fields, the Format values are possible: DateOnly - Display (and allow edits to) only the date portion (the time portion is set to 12:00 A.M. for all edited values). DateTime - Display and edit both date and time of day (default).

share|improve this answer
I looked at few places on Google to find the formula for calculated column field for "TimeOnly" but couldn't fine one, unless your asking me to save time in a textcolumn. cheers – Muhammad Raja Mar 12 '12 at 13:09

The formula for time only is

TEXT([DateTimeField], "hh:mm:ss")
share|improve this answer
Cheers +1 for the post – Muhammad Raja Mar 15 '12 at 9:21

You can add XSL-file to your list views for format of dates or using SPD. Under Miscellaneous there is an option to add a XSL link.

I'll give you an example, I'm not an expert on XSL, but the stylesheet under works. If its the best way to do it I don't know :)

<xsl:stylesheet xmlns:x="" xmlns:d="" version="1.0" exclude-result-prefixes="xsl msxsl ddwrt" xmlns:ddwrt="" xmlns:asp="" xmlns:__designer="" xmlns:xsl="" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal" xmlns:o="urn:schemas-microsoft-com:office:office">
    <xsl:include href="/_layouts/xsl/main.xsl"/>
    <xsl:include href="/_layouts/xsl/internal.xsl"/> 
    <xsl:template name="FieldRef_DateTime_body.DueDate" match="FieldRef[@Name='DueDate']"  mode="DateTime_body" ddwrt:dvt_mode="body">
        <xsl:param name="thisNode" select="."/>
            <xsl:value-of select="ddwrt:FormatDate(string($thisNode/@DueDate),1033,4)" />

Note the format flag used is 4 for FormatDate, which means it takes out the Time Only, not the dates.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.