Forums
This topic is locked
Help with formatting dates in dreamweaver usingasp
Posted 18 Nov 2003 05:26:51
1
has voted
18 Nov 2003 05:26:51 Daniel Rula posted:
Unfortauntly Im having a little issue at the moment with getting dates to format properly. The site is www.scenereview.net, and I can get the site to format the dates (as seen up the top) into a 23/6 format instead of 23/6/2003. It may sound simple, but unfortauntly im stumped.PS: The same goes with cahnging Wednesday 25th of October, 2003 to Wed 25th Oct
Any ideas? (Using an access/vb script framework)
Replies
Replied 18 Nov 2003 09:22:22
18 Nov 2003 09:22:22 Nozomi Kugita replied:
You can do that with ASP.NET. (I'm not sure if you are with ASP.NET VBScript or ASP VBScript. I assumed .NET because you have mentioned the word "Framework"....If not, never mind the below.)
---------------------------------------------
After you create dataset and insert it into your document, selecting the {<i>dataset.theDate</i>} will hilights "<i>theDate</i>" in the Binding panel. Then you can choose your desired format from the dropdown. I know you don't see the format you like - you have to modify the code Dreamweaver inserted for you.
This is how it looks like when you insert the date data type:
< %# <i>DataSet1</i>.FieldValue("<i>theDate</i>", Container) % >
If you follow the step above, DW changes the above to something like this:
< %# DateTime.Parse(<i>DataSet1</i>.FieldValue("<i>theDate</i>", Container)).<b>ToString("D"
</b> % >
So if you want "23/6" or "Wed 25th Oct", you can specify it within ToString() method.
The following converts the date to 23/6 format:
< %# DateTime.Parse(<i>DataSet1</i>.FieldValue("<i>theDate</i>", Container)).ToString(<b>"d/M"</b>
% >
This, to Wed 25th Oct
< %# DateTime.Parse(<i>DataSet1</i>.FieldValue("<i>theDate</i>", Container)).ToString(<b>"ddd, d'th' MMM"</b>
% >
Was this what you were asking?
HTH,
- Noz
Edited by - Noz on 18 Nov 2003 09:59:42
---------------------------------------------
After you create dataset and insert it into your document, selecting the {<i>dataset.theDate</i>} will hilights "<i>theDate</i>" in the Binding panel. Then you can choose your desired format from the dropdown. I know you don't see the format you like - you have to modify the code Dreamweaver inserted for you.
This is how it looks like when you insert the date data type:
< %# <i>DataSet1</i>.FieldValue("<i>theDate</i>", Container) % >
If you follow the step above, DW changes the above to something like this:
< %# DateTime.Parse(<i>DataSet1</i>.FieldValue("<i>theDate</i>", Container)).<b>ToString("D"

So if you want "23/6" or "Wed 25th Oct", you can specify it within ToString() method.
The following converts the date to 23/6 format:
< %# DateTime.Parse(<i>DataSet1</i>.FieldValue("<i>theDate</i>", Container)).ToString(<b>"d/M"</b>

This, to Wed 25th Oct
< %# DateTime.Parse(<i>DataSet1</i>.FieldValue("<i>theDate</i>", Container)).ToString(<b>"ddd, d'th' MMM"</b>

Was this what you were asking?
HTH,
- Noz
Edited by - Noz on 18 Nov 2003 09:59:42