Re: ASP.Net [2.0] - Converting a date to a new format...



"Rob Meade" <ten.bewdoowsgnikNO-SPAM@xxxxxxxxxx>'s wild
thoughts were released on Tue, 23 May 2006 18:31:39 GMT
bearing the following fruit:

"Jan Hyde" wrote ...

I tried to mimic your setup but I still get the option to
provide a format string. I just know this is gonna be
something so simple we'll both kick ourselves.

Hi Jan, ok - my apologies for the delay - the following is my code, its a
bit lengthly for a group posting but I figured you'd wanna see it all
really..please also note that this is a work in progress so some things
aren't finished yet (although feel free to comment upon anything you thinks
a bit poor)...you might wanna paste this into VS to make it reformat a bit
better...

Basically, when I log in, I run a function to get my the user (GetUser) -
which I pass my username/password to (I mention this only because there are
2 GetUser functions below).

This returns me my "User" object - the ProfileLastUpdated has been populated
with a date from SQL Server and it includes the time.

I then populate my session variables accordingly; for the one in question:

Session("ProfileLastUpdated") = User.ProfileLastUpdated

This should currently hold a "date"

On my "UpdateProfile.aspx" page, if the page is not a post back then I
display a label which should have a date and time in it:

lblProfileLastUpdated.Text = "last updated " & <my_value_goes_here>

So, if I do this:
lblProfileLastUpdated.Text = "last updated " & Session("ProfileLastUpdated")

I get this on the page:

"last updated 23/05/2006 19:17:21" for example...

If I type this:
lblProfileLastUpdated.Text = "last updated " &
User.ProfileLastUpdated.ToString().ToString( <-- the intellisense at this
point displays and I get two options...

Remove the *second* .ToString

Jan Hyde (VB MVP)

--
Isolate: Delay because of frozen roads (Ray Hand)

.



Relevant Pages