473,394 Members | 1,870 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,394 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 1220
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.