|
-
Losing comma's
I'm trying to get details from athree FComboBoxes named "year", "month" and "day" and then insert the details into a MySql database in the "YYYYMMDD" format.
The method I use below gets me an output of "YYYY,MM,DD".
All I need to do is get rid of the comma's, but the "Strip" command as suggested by other threads here doesn't seem to work.
I think I must be either missing a basic principle here, or have missed an easier way to go about it.
TIA
Code:
dayValue=period.day.getValue(); // Extracting values
monthValue=period.maand.getValue(); // from drop down
yearValue=period.jaar.getValue(); // FComboBoxes
//adding "0's" for entry into Mysql Database
if(dayValue<10){
dayValue = "0" + dayValue;
}
if(monthValue<10){
monthValue = "0" + monthValue;
}
periodDate=[yearValue,monthValue,dayValue]; // Making array
NewPeriodDate = periodDate.split(",").join(""); // Doesn't work:confused:
trace(periodDate); // returns YYYY-MM-DD
trace(NewPeriodDate); // returns "undefined"
Last edited by skalie; 08-14-2003 at 05:12 AM.
-
Code:
dayValue=period.day.getValue(); // Extracting values
monthValue=period.maand.getValue(); // from drop down
yearValue=period.jaar.getValue(); // FComboBoxes
//adding "0's" for entry into Mysql Database
if(dayValue<10){
dayValue = "0" + dayValue;
}
if(monthValue<10){
monthValue = "0" + monthValue;
}
periodDate=dayValue+monthValue+yearValue; // Making STRING
What's wrong with this approach ... were you just complicating things for the sake of it, or am I missing something?
----------
"Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life." TERRY PRATCHETT
-
What's wrong with this approach ... were you just complicating things for the sake of it, or am I missing something?
Not for the sake of it, I'm just new to array syntax, and thanks.
I did however just discover how do it the complicated way.....
Code:
//NewPeriodDate = periodDate.split(",").join(""); // Doesn't work
NewPeriodDate = periodDate.join(""); // Works like a charm
Fow what it's worth.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|