Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > date format question

Reply
Thread Tools

date format question

 
 
=?Utf-8?B?QXJ0eVNpbg==?=
Guest
Posts: n/a
 
      10-20-2006
I have a problem trying to get a date format of dd/mm to appear in my web
page from a sql server database table. Various sites state that you can use
the{0:dd/mm/yyyy} format which works fine as does {0:d} for a result of '20
Oct' but {0:dd/mm} returns the day but only '00' for the month. Anyone any
ideas? Code I have is below. Thanks in advance.

<%#String.Format("{0:dd/mm}",
Convert.ToDateTime(Container.DataItem("Date")))%>
 
Reply With Quote
 
 
 
 
Eric Theil
Guest
Posts: n/a
 
      10-20-2006
Try:

String.Format("{0:dd/MM}", ...);

lowercase m represents minutes and uppercase represents months

e

"ArtySin" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I have a problem trying to get a date format of dd/mm to appear in my web
> page from a sql server database table. Various sites state that you can
> use
> the{0:dd/mm/yyyy} format which works fine as does {0:d} for a result of
> '20
> Oct' but {0:dd/mm} returns the day but only '00' for the month. Anyone any
> ideas? Code I have is below. Thanks in advance.
>
> <%#String.Format("{0:dd/mm}",
> Convert.ToDateTime(Container.DataItem("Date")))%>



 
Reply With Quote
 
 
 
 
=?Utf-8?B?QXJ0eVNpbg==?=
Guest
Posts: n/a
 
      10-20-2006
BRILLIANT!!! well done works perfectly.

"Eric Theil" wrote:

> Try:
>
> String.Format("{0:dd/MM}", ...);
>
> lowercase m represents minutes and uppercase represents months
>
> e
>
> "ArtySin" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> >I have a problem trying to get a date format of dd/mm to appear in my web
> > page from a sql server database table. Various sites state that you can
> > use
> > the{0:dd/mm/yyyy} format which works fine as does {0:d} for a result of
> > '20
> > Oct' but {0:dd/mm} returns the day but only '00' for the month. Anyone any
> > ideas? Code I have is below. Thanks in advance.
> >
> > <%#String.Format("{0:dd/mm}",
> > Convert.ToDateTime(Container.DataItem("Date")))%>

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Date, date date date.... Peter Grison Java 10 05-30-2004 01:20 PM
Date Format - best way of converting a string into a date format Brian Candy ASP .Net 2 02-18-2004 02:13 PM
Given a date, how to find the beginning date and ending date of that week Matt ASP .Net 1 11-08-2003 09:14 PM
Given a date, how to find the beginning date and ending date of that week Matt C Programming 3 11-08-2003 09:07 PM
Given a date, how to find the beginning date and ending date of that week Matt C++ 2 11-08-2003 08:30 PM



Advertisments