Wrox Programmer Forums
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 6th, 2008, 10:27 PM
Registered User
Join Date: Oct 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Formatting Time Output

I have a listview control that I am trying to format the time on. The catch is that this is a SQL 2008 database. The datatype of the EVENT_TIME column is the new SQL 2008 TIME datatype so it seems that the traditional way of formatting the output doesn't work.

The value in the database is "18:30:00", however, I want it to show up as "6:30 PM" instead.

This code outputs it as "18:30:00" even though the formatting is specified:

<asp:Label ID="LBL_TIME" runat="server" Text='<%# Eval("EVENT_TIME", "{0:hh:mm tt}")%>' />

Any help would be appreciated.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Formatting Database Output Gobbles Classic ASP Basics 3 September 25th, 2007 05:08 AM
Output Formatting Neal XSLT 2 October 12th, 2006 05:12 AM
formatting date time Adam H-W Classic ASP Basics 4 September 29th, 2004 03:35 AM
Formatting Output Colonel Angus SQL Server 2000 3 September 1st, 2004 10:35 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.