[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: Converting DateNum() to a string...



PureBytes Links

Trading Reference Links

Tomasz,

I did try WriteVal. The problem I ran into was that integer value 
such as 20021010 came back with commas, like 200,210,10 which I could 
not get rid of. And I'm quite puzzled that passing the number 
returned by DateNum didn't work for me in the way I tried it (as 
mentioned in my original post). Do you have any idea if its a bug or 
if its something that I did wrong?

Andrew, thanks for your suggestion. I'll try it. I have it now 
working as follows (which gives me a 8 digit number, with leading 0's 
when warranted). Couldn't think of any other way to get it to work. 
By leading 0's, I mean that I want the string to be 20020310 when the 
date is 10/3/2002, instead of 2002310.

------------------

EnableScript("vbscript");

gYstr = "" + Year();
gMstr = "" + Month();
gDstr = "" + Day();
<%
  Dim mstr
  Dim dstr
  mstr = AFL("gMstr")
  if( Len(mstr) < 2 ) then mstr = "0" + mstr
  dstr = AFL("gDstr")
  if( Len(dstr) < 2 ) then dstr = "0" + dstr
  AFL("gMstr") = mstr
  AFL("gDstr") = dstr
%>
gDateNumStr = gYstr + gMstr + gDstr;

-----------------

Jitu

--- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <amibroker@xxxx> 
wrote:
> Hello,
> 
> Use formatDateTime in conjunction with WriteVal
> http://www.amibroker.com/guide/afl/afl_view.php?name=WRITEVAL
> 
> 
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message ----- 
> From: "jtelang" <jtelang@xxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Wednesday, September 10, 2003 11:54 PM
> Subject: [amibroker] Converting DateNum() to a string...
> 
> 
> > I'm trying to use the number returned by DateNum() in a string 
> > that'll designate a unique filename for each day, and for some 
reason 
> > am unable to use the value returned. Here's a simplified example, 
> > when trying to set it as a string to title. Does anyone know why 
this 
> > wouldn't work? I get a syntax error on this -
> > 
> > EnableScript("vbscript");
> > dn = DateNum();
> > <%
> >  AFL("Title") = CStr(AFL("dn"))
> > %>
> > 
> > Following does work -
> > 
> > EnableScript("vbscript");
> > dn = 9999999;
> > <%
> >  AFL("Title") = CStr(AFL("dn"))
> > %>
> > 
> > What's the difference in assigning a constant vs a value returned 
by 
> > DateNum to variable dn? FWIW, I tried ABTool's xxToString() 
function 
> > as well. Similar problem...
> > 
> > TIA,
> > 
> > Jitu
> > 
> > 
> > 
> > 
> > Send BUG REPORTS to bugs@xxxx
> > Send SUGGESTIONS to suggest@xxxx
> > -----------------------------------------
> > Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
> > (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> > --------------------------------------------
> > Check group FAQ at: 
http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> > 
> > Your use of Yahoo! Groups is subject to 
http://docs.yahoo.com/info/terms/ 
> > 
> > 
> >


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark
Printer at Myinks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/l.m7sD/LIdGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/