Woah, Mama! (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


DarlingBri -> Woah, Mama! (2/18/2002 0:04:17)

OK, I'm using the DRW to pull a single record from a database. The field is a test field or a memo field - whichever is bigger, I can never remember. Anyway, there's rather a lot of text in there, and I only want it to display the first, say, 300 characters or whatever.

Just, you know... less!

Oh, and also, I need to display the associated date, which is being displayed. However, it's stored in the database as 20020213072621 - which is: year 2002 month 02 day 13 time 07:26:21. But I want it to display like, you know, any normal date and time!

Can someone smart tell me how do I do that? Thanks

--Bri
-----
#!usr/bin/girl




rdouglass -> RE: Woah, Mama! (2/18/2002 8:53:19)

Using something like:

<%=Left(FP_FieldVal(fp_rs,"memoField"),300)%>

will get you the first 300 char of your memo field.

<%=FormatDateTime(FP_FieldVal(fp_rs,"dateField"), 2)%>

will give you the date from 'dateField' in MM/DD/YYYY format. See this link for more details:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/vsfctformatdatetime.asp

Hope it helps...

 




DarlingBri -> RE: Woah, Mama! (2/18/2002 9:08:49)

Thank you for your reply :)

It seems to think that <%=FormatDateTime(FP_FieldVal(fp_rs,"T_DATE"), 2)%> is a "Microsoft VBScript runtime error '800a0005' Invalid procedure call or argument: 'FormatDateTime'" though


--Bri
-----
#!usr/bin/girl




DarlingBri -> RE: Woah, Mama! (2/18/2002 9:11:00)

Oooh, but the 300 characters thing works perfectly! Thank you

--Bri
-----
#!usr/bin/girl




rdouglass -> RE: Woah, Mama! (2/18/2002 9:46:09)

OOPS - I may have missed something. Is it stored in the DB as a text string and not a date/time field? If so, you may need to grab the date(s) using string manipulation. Something like:

<%=Mid(FP_FieldVal(fp_rs,"dateField"), 5, 2)%>/<%=Mid(FP_FieldVal(fp_rs,"dateField"), 7, 2)%>/<%=Left(FP_FieldVal(fp_rs,"dateField"),4)%>

That should give you a string that looks like MM/DD/YYYY however, that is not a date/time value. AT least that's how I'd do it if it is a text string and not a date/time field....

 




DarlingBri -> RE: Woah, Mama! (2/18/2002 10:03:16)

I have no idea how it's stored except as a string of silly numbers, but what you just said works perfect-o!

xoxoxoxoxo

--Bri
-----
#!usr/bin/girl




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.078125