Friday, March 9, 2012

formating date

I'm retreiving a date column from database which looks like '7/13/2006 3:49:50 PM' but I would like to show it as '7/13/2006'

please help me in doing this

Use the .toshortdate construct. Here's an example.

If your loading your data into a dataset, and your column field is lastupdateddate it'd be something like this

dataset.tables(0).rows(rownumber).item("lastupdateddate").toshortdate

|||

Right click the container holding the field from the database (ie: textbox, table cell, etc). Click properties. On the right part of the dialogue, you should see Date under the 'Standard' radio button. Click 'Date', and then pick the format that suits your needs. In this case, the bottom one. M/D/YYYY

|||

hey there

another way is in your layout view - in datefield type this

=Format(Datefield,"dd MMM yy")

or whatever your format is.

cheers

|||

Another option would be to retrieve only the date information you want to display from the database:

select <fieldname>, <fiedname>, isnull((convert(char(10), DismissalDate, 101)),'') as DismissalDate

No comments:

Post a Comment