Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
My substring() isn't working
Old 08-14-2008, 02:25 PM My substring() isn't working
Average Talker

Posts: 19
Name: Meir Ech
Trades: 0
What am not getting about substring()?
I'm trying to do is separate out the dd and yy
from input coming in as mm/dd/yy.
(My mm is parsing out correctly).

Code:
	var mm = apptdate.substring(0, apptdate.indexOf("/"));
	var ddlength = (apptdate.lastIndexOf("/")-1-apptdate.indexOf("/") );
	var ddstartat = (apptdate.indexOf("/")+1);
	var dd = apptdate.substring(ddstartat, ddlength);
	var yylength = (apptdate.length - 1 - apptdate.lastIndexOf("/"));
	var yystartat = (apptdate.lastIndexOf("/")+1);
	var yy = apptdate.substring(yystartat, yylength);
ruffy is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-14-2008, 02:39 PM Re: My substring() isn't working
nyef's Avatar
Ultra Talker

Posts: 265
Name: Lucas
Trades: 0
Wouldn't this be easier:

Code:
var datearray=apptdate.split('/');
var mm=datearray[0];
var dd=datearray[1];
var yy=datearray[2];
__________________
~nyef

Please login or register to view this content. Registration is FREE
nyef is offline
Reply With Quote
View Public Profile Visit nyef's homepage!
 
Reply     « Reply to My substring() isn't working
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.09936 seconds with 12 queries