Answered by:
DateTime fields only showing date, not time

>
Question
-
Hi everybody!
I'm using MOSS 2007 and have defined a custom list with some datetime fields (Type="DateTime")
Problem now is that only the date gets displayed, and not the time, e.g.
FieldnameXYZ 2009-08-04
but I want it to display
FieldnameXYZ 2009-08-04 HH:MM
where HH:MM is the time of the DateTime field.
How can I do that?- Moved by Mike Walsh FIN Monday, August 31, 2009 6:18 PM admin q (From:SharePoint - Development and Programming)
Monday, August 31, 2009 2:48 PM
Answers
-
Ok, got it:
Format="DateTime"
That does the trick.
- Marked as answer by five13 Tuesday, September 1, 2009 7:11 AM
Tuesday, September 1, 2009 6:50 AM -
i just checked by creating a new field of type date time and in the setting below "Date and Time Format" you have to select "Date & Time". Now it will display the time. by default when you create a column of datetime, date time format is date only. so you have to change it to date & time.
Moonis Tahir MVP, MCPD, MCSD.net, MCTS BizTalk 2006/SQL 2005/SharePoint Server 2007 (Dev & Config)- Proposed as answer by Moonis Tahir Monday, August 31, 2009 5:16 PM
- Marked as answer by Rock Wang– MSFT Tuesday, September 1, 2009 8:16 AM
Monday, August 31, 2009 3:22 PM -
When you are creating custom list column with 'Date' type, there is a option to select the 'Date & Time Format' (with two values 'Date Only' and 'Date & Time' ).
Check if you select the 'Date & Time' format or not.
--JP- Proposed as answer by Jayaprakash Lingamaneni Monday, August 31, 2009 6:29 PM
- Marked as answer by Rock Wang– MSFT Tuesday, September 1, 2009 8:16 AM
Monday, August 31, 2009 3:24 PM
All replies
-
i just checked by creating a new field of type date time and in the setting below "Date and Time Format" you have to select "Date & Time". Now it will display the time. by default when you create a column of datetime, date time format is date only. so you have to change it to date & time.
Moonis Tahir MVP, MCPD, MCSD.net, MCTS BizTalk 2006/SQL 2005/SharePoint Server 2007 (Dev & Config)- Proposed as answer by Moonis Tahir Monday, August 31, 2009 5:16 PM
- Marked as answer by Rock Wang– MSFT Tuesday, September 1, 2009 8:16 AM
Monday, August 31, 2009 3:22 PM -
When you are creating custom list column with 'Date' type, there is a option to select the 'Date & Time Format' (with two values 'Date Only' and 'Date & Time' ).
Check if you select the 'Date & Time' format or not.
--JP- Proposed as answer by Jayaprakash Lingamaneni Monday, August 31, 2009 6:29 PM
- Marked as answer by Rock Wang– MSFT Tuesday, September 1, 2009 8:16 AM
Monday, August 31, 2009 3:24 PM -
Hi,
Can you elaborate more on your problem. Becasue While creating Field if you select Date Only, then in List View it will only show Date in that field. And if you select Date & Time then it will only show date and time.
Regards,
Milan.
Monday, August 31, 2009 3:28 PM -
Moving to Admin. This isn't programming.
WSS FAQ sites: http://wssv2faq.mindsharp.com and http://wssv3faq.mindsharp.com
Total list of WSS 3.0 / MOSS 2007 Books (including foreign language) http://wssv3faq.mindsharp.com/Lists/v3%20WSS%20FAQ/V%20Books.aspxMonday, August 31, 2009 6:18 PM -
The field isn't created via SharePoint-Web-Interface, but via feature:
<Field ID="{097378A1-6HBD-4777-8EC0-2V53312FC913}"
Name="testDateField"
SourceID="http://schemas.microsoft.com/sharepoint/v3"
StaticName="testDateField"
Group="Test Group"
Type="DateTime"
DisplayName="Test Date Field"
CanToggleHidden="TRUE"
Hidden="FALSE"
DisplaceOnUpgrade="TRUE"
Filterable="TRUE"
IMEMode="inactive"
Indexed="FALSE"
ReadOnly="FALSE"
Required="FALSE"
RichText="FALSE"
ShowInDisplayForm="FALSE"
ShowInEditForm="FALSE"
ShowInListSettings="FALSE"
ShowInNewForm="FALSE"
ShowInVersionHistory="FALSE"
ShowInViewForms="FALSE"
Sortable="TRUE"
StripWS="TRUE"
Viewable="TRUE">
</Field>
But you are right, when I open the Edit Column Page for this Field, the "Date and Time Format" is set to "Date only".
Question now is how to set the "Date and Time Format" programmatically to "Date & Time".Tuesday, September 1, 2009 5:58 AM -
Ok, got it:
Format="DateTime"
That does the trick.
- Marked as answer by five13 Tuesday, September 1, 2009 7:11 AM
Tuesday, September 1, 2009 6:50 AM