Questions about formating Dates

C

Cal Who

I found documentation for this way to format a date:
endtime.ToString("dddd, MMM d yyyy")

But I can't find an explanation of this method:
<%#Eval("CreateDate", "{0:d}")%>

The first on produces Saturday, Apr 3 2010
Note no comma after the 3?
Can I make it add a comma?

The second one produces:
Friday, April 02, 2010
Can I supress the leading zero?


Best for me would be in both cases:
Friday, April 2, 2010
Can I do that?


Thanks
 
C

Cal Who

I never did find info about the Eval syntax but I managed to answer my
questions anyway.
It's possible to replace the d with a format string (no quotes around it)
 
A

Andy O'Neill

Cal Who said:
I never did find info about the Eval syntax but I managed to answer my
questions anyway.
It's possible to replace the d with a format string (no quotes around it)

You may want to read up on formatting, any documentation ought to explain
what's going on there.
 
C

Cal Who

Andy O'Neill said:
You may want to read up on formatting, any documentation ought to explain
what's going on there.

I couldn't find any for {0:d}
Probably right there but I couldn't find it.


Thanks
 
C

Cal Who

That was just a Google search which I had done many times. I never did find
and example with a 0 (zero) in it.\

Thanks
 
A

Andy O'Neill

3rd on my list was
4 guys from rolla specifically explains the 0 is a placeholder and the
letter a standard format to apply.
4th has a whole bunch of examples with zeroes in them.
I got bored after that.
 
C

Cal Who

My browser tells me I skipped the 3rd one but I did open the 4th one.
Why I didn't see the zeros I don't know.
Maybe by then (I had looked before) I didn't expect to see any and only saw
what I expected.

Thanks for your patience.
 
A

Andy O'Neill

Cal Who said:
My browser tells me I skipped the 3rd one but I did open the 4th one.
Why I didn't see the zeros I don't know.
Maybe by then (I had looked before) I didn't expect to see any and only
saw what I expected.

Thanks for your patience.

No problem.
Always happy to help a fellow developer.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,077
Latest member
SangMoor21

Latest Threads

Top