473,320 Members | 1,719 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

client side code

I got this code in my client side but I'm not sure what this supposed to
do.. can someone tell me?

function FormatXMLTime(aTime)
{
// Extract the date
//
var date = aTime.substring(0, aTime.indexOf("T", 0));

// Remove the date.
//
var temp = aTime.replace(date, "");
var temptime = temp.replace("T", "");

// Extract the time.
//
var time = temptime.substring(0, temptime.indexOf("-", 0));

return time;
}

return time won't return anything.. if I put this code
return date + " " + time; then it will return only the date
But I check the format of the date/time in the xml file and it's like
this:

2007-12-04T09:26:59.953+00:00

So does that means this function won't return the time or the function
is not getting the substring of the time?


Cheers!

Claudi

*** Sent via Developersdex http://www.developersdex.com ***
Dec 12 '07 #1
1 1217
Claudia Fong explained on 12-12-2007 :
I got this code in my client side but I'm not sure what this supposed to
do.. can someone tell me?

function FormatXMLTime(aTime)
{
// Extract the date
//
var date = aTime.substring(0, aTime.indexOf("T", 0));

// Remove the date.
//
var temp = aTime.replace(date, "");
var temptime = temp.replace("T", "");

// Extract the time.
//
var time = temptime.substring(0, temptime.indexOf("-", 0));

return time;
}

return time won't return anything.. if I put this code
return date + " " + time; then it will return only the date
But I check the format of the date/time in the xml file and it's like
this:

2007-12-04T09:26:59.953+00:00

So does that means this function won't return the time or the function
is not getting the substring of the time?
"temp" should contain "T09:26:59.953+00:00"
"temptime" should contain "09:26:59.953+00:00"
(although you could have gotten here with a substring *from* the "T")

but then you search for a "-", did you mean a "+"?

And a different way could be:
var date = aTime.substring(0, 10);
var time = aTime.substring(11, 8);
as the lengths are fixed.

Hans Kesting
Dec 12 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Kathryn | last post by:
Hiya I have a problem with using some client side and server side scripting together in an ASP. I'm using VBScript. What I'm trying to achieve is this - - Page loads up and some server side...
18
by: cjl | last post by:
Hey all: I know that it is silly in the age of Google to 'lose' something on the internet, but I recently checked out a project that had implemented a database with a subset of SQL in pure...
6
by: Ken Allen | last post by:
I am relatively new to .Net and C#, but I hav ebeen programing in other languages and done some COM work for a number of years. I am attempting to understand how to map an older program...
2
by: Matt | last post by:
I guess the principal differences between client-side and server-side code is that client-side code is processed in web browser, and server-side code is processed in web server. In ASP.NET web...
4
by: | last post by:
Hello Guys, I am using the validation controls to validate my data. But the problem is "The page is still being posted to server". I want to get rid of the round trips to server. Are there...
14
by: Matt | last post by:
I want to know if ASP.NET Web Forms Validation Controls are Server-Side or Client-Side form validation? Since I think each validator control can select either 1) JavaScript based error dialog or 2)...
8
by: Mike Fellows | last post by:
Ok, im not sure if this is at all possible and if it is how i go about it is beyond me i have a piece of client side code that requires a piece of data from the server side (an ID number in this...
10
by: Ben | last post by:
Hi, I made an application in classic asp (reservation of books and video stuffs for students) and want to migrate to asp.net. The user has to chose a date, then pushung on a submit button. The...
3
by: Simon Brooke | last post by:
I've been doing XSL transforms, converting XML to HTML, server side since 2000. In those days, clients which could do the transformation client side didn't exist, so whether to transform...
1
by: Chris | last post by:
Hi, I have jsut started to learn ASP development and have read many articles regarding which is the best to use regarding JavaScript or VBScript. All of the learning that I have done so far has...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.