Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date formatting. 1

Status
Not open for further replies.

lengoo

IS-IT--Management
Jan 15, 2002
381
GH
Hi All,
I have the following bit of code built by the Frontpage XP wizard.

<!--webbot bot=&quot;DatabaseResultColumn&quot; s-columnnames=&quot;Key,Date,News,Hyperlink&quot; s-column=&quot;Date&quot; b-tableformat=&quot;TRUE&quot; b-hashtml=&quot;FALSE&quot; b-makelink=&quot;FALSE&quot; clientside b-MenuFormat preview=&quot;&lt;font size=&quot;-1&quot;&gt;&amp;lt;&amp;lt;&lt;/font&gt;Date&lt;font size=&quot;-1&quot;&gt;&amp;gt;&amp;gt;&lt;/font&gt;&quot; startspan --><%=FP_FieldVal(fp_rs,&quot;Date&quot;)%><!--webbot bot=&quot;DatabaseResultColumn&quot; endspan i-checksum=&quot;3267&quot; --></font>

This displays the date from an Access table. However, the date which appears is formatted in the American standard (mm/dd/yy), I would like it to be formatted in the European standard (dd/mm/yy). Is this possible from the code? I don't have a clue what the webbot stuff is about!
Even better would it be possible to convert the dates into say 15 November etc. I found a ConvDate.inc file which allows me to do this but I can't get it to work and I notice if I try and update certain areas in this Frontpage html page, it disallows me!

Many thanks
 
Instead of this:
<%=FP_FieldVal(fp_rs,&quot;Date&quot;)%>

Try this....

<%=formatDateTime(fp_rs(&quot;date&quot;))%>

I'm not sure, but I think that &quot;fp_rs&quot; is the name of the recordset and &quot;date&quot; is the field we want. FormatDatetime will use your computers regional setting to format the date... -- Just trying to help...
[wolf]<--- This is a wolf? We need a new icon.......
mikewolf@tst-us.com
 
Thanks Wolf,
The syntax worked ok but the date wasn't formatted when it appeared, still appeared in the American Format..

Any ideas??
 
Are you sure that your computers regional setting are set to european date ? To check goto &quot;config pannel>regional Settings>date&quot; Water is not bad as long as it stays out human body ;-)
 
Yep, they are.. however, following on from mwolfs advice, I have used the following command:

<%=formatDateTime(fp_rs(&quot;date&quot;, 1))%>

Which has given me the long date in the format:

Wednesday, November 20, 2002

Is there a function to strip out the days, strip out everything to the first comma?

This forum is fantastic, thanks for all the help!
 
<%=MID(formatDateTime(fp_rs(&quot;date&quot;, 1)),INSTR(formatDateTime(fp_rs(&quot;date&quot;, 1))+1,&quot;,&quot;))%> -- Just trying to help...
[wolf]<--- This is a wolf? We need a new icon.......
mikewolf@tst-us.com
 
Thanks Wolf,
However, I am getting the error:

Wrong number of arguments or invalid property assignment: 'fp_rs'
/ms_asp2/intrabase_interface/Results/newresults.asp, line 77


Any ideas???
 
OOPPS I copied that chunk from your post....

Use this:
<%=MID(formatDateTime(fp_rs(&quot;date&quot;)),INSTR(formatDateTime(fp_rs(&quot;date&quot;)),&quot;,&quot;)+1)%>

-- Just trying to help...
[wolf]<--- This is a wolf? We need a new icon.......
mikewolf@tst-us.com
 
Hi Wolf
I'm slowly understanding the way of thinking which goes into this process, I've been thinking about how you are working this all out and I'm really amazing how clever yet so simple it can be (to an experienced programmer like yourself). I didn't have any luck with that statement you just posted however....
I have also tried to use my own statement which is:

<%=Right(&quot;formatDateTime(fp_rs(&quot;date&quot;,1))&quot;,InStr(formatDateTime(fp_rs(&quot;date&quot;,1)),&quot;,&quot;))%>

However, I'm given the error message@

Microsoft VBScript compilation (0x800A03EE)
Expected ')'
/ms_asp2/intrabase_interface/Results/newresults.asp, line 77, column 44

I can't see where the missing ) needs to be... have I missed anything?

Thanks so much for the help, it's been very insightful!
 
I can't see one missing.
fp_rs(&quot;date&quot;,1) isn't giving you an error? I was using fp_rs(&quot;date&quot;)....

Try this

<%
myVar = fp_rs(&quot;date&quot;)
printStr = MID(myVal,INSTR(myVal,&quot;,&quot;)+1)
response.write printStr
%> -- Just trying to help...
[wolf]<--- This is a wolf? We need a new icon.......
mikewolf@tst-us.com
 
Thanks MWolf for all the help. I used the

<%=formatDateTime(fp_rs(&quot;date&quot;, 1))%>

with the 1 argument since this formats the date in the long date I wanted and it wasn't given me an error. If I use just fp_rs(&quot;date&quot;) I get the short format of mm/dd/yy which means the MID and INSTR command doesn't strip the correct string.

I tried the code that you had put down for me (the very last one) but still doesn't like it, this time it says invalid character?!!?

Anyway, it's all too confusing... not sure what's happening anymore!!! I'll work at it but any hints please let me know :)
 
I have finally got this sorted...

I have used
<% myVar= formatDateTime(fp_rs(&quot;date&quot;),1)
printStr = MID(myVar, INSTR(myVar,&quot;,&quot;)+1)
response.write printStr
%>

as per mwolf's post. I did a copy and paste with Mwolf's post and there was a error I didn't spot (variable was myVar to start off with but became myVal later).

Mwolf, many thanks for all the help you've provided!!!!

All teh best :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top