-
thinger in javascript?
ok... how can i do something like this in javascript??
thinger = "ljsdf sdf +qihsasdf asfhkasdfg"
thinger = Strings.Mid(thinger, InStr(thinger, "+"))
thinger = Strings.Mid(thinger, 1, InStr(thinger, " ") - 1)
... and yes i have my reasons
thanks
kris
-
Code:
var thinger = "ljsdf sdf +qihsasdf asfhkasdfg";
thinger = thinger.substr(thinger.indexOf('+');
thinger = thinger.substr(thinger.indexOf(' ') - 1, 1);
Is that what you mean? Not really getting you here.
-
substr(point,length)
or
substring(point,other_point)
I use the 2nd a lot more, from a certain point to another one.
-
no... actually i meant
<script language="JavaScript">
today = new Date();
var thinger = today.toString();
thinger = thinger.substr(thinger.indexOf('UTC'));
thinger = thinger.substr(3, thinger.indexOf(' ')-3);
document.write(thinger);
</script>
... but u're code was good .. i could work out how 2 adapt in in bout 1 min :)
... and as u can c i have used it to return the users time zone ...
-
hmmm ... found a page:
http://www.w3schools.com/js/js_datetime.asp
on witch i found a nice little thing : getTimezoneOffset
so now this does the same thing :
<script language="JavaScript">
var d = new Date()
document.write((0 - d.getTimezoneOffset())/60);
</script>