Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 246723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T21:11:47+00:00 2026-05-11T21:11:47+00:00

I am trying to use jQuery to break right ascension and declination data into

  • 0

I am trying to use jQuery to break right ascension and declination data into their constituents (hours, minutes, and seconds) and (degrees, arc-minutes, and arc-seconds), respectively from a string and store them in variables as numbers. For example:

$dec = "-35:48:00" -> $dec_d = -35, $dec_m = 48, $dec_s = 00

Actually, the data resides in a cell (with a particular class (‘ra’)) in a table.
At present, I have gotten this far:

var $dec = $(this).find(".ra").html();

This gives me the declination as a string but I cannot figure out how to parse that string.
I figured out the regular expression (-|)+\d+ (this gives me -35 from -35:48:00) to get the first part. How do I use that in conjunction with my code above?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T21:11:47+00:00Added an answer on May 11, 2026 at 9:11 pm

    This should do it:

    var dec = '-35:48:00';
    var parts = dec.split(':');
    

    parts[0] would then be -35, parts[1] would be 48, and parts[2] would be 00

    You could run them all through parseInt(parts[x], 0) if you want integers out of the strings:

    var dec_d = parseInt(parts[0], 10);
    var dec_m = parseInt(parts[1], 10);
    var dec_s = parseInt(parts[2], 10);
    

    I should point out this really has nothing to do with jQuery and is a Javascript problem (past getting the values out of the HTML document, at least) – The practice of prefixing a variable with a $ is usually done to signify that the variable contains a jQuery collection. Since in this situation it contains HTML, it is a little misleading

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use javascript, without framework(prototype, jQuery,etc), to insert data passed from
I am need paint my image. I'm trying use JQuery in here this link:
I'm trying to use jquery to detect when the ENTER key is pressed AND
I am trying to use jQuery with CoffeScript . I was following the instructions
I am trying to use jQuery's bounce effect on a few images. When I
I'm trying to use Jquery to pass the value of one box that already
I am trying to use jQuery's draggable and sortable to sort elements listed inside
I'm trying to use jQuery.scrollTo plugin with accordion (where one block expands after clicking
I'm trying to use jQuery UI tabs much like a Master Page in ASP.Net.
I'm trying to use JQuery to select all of the TD 's in a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.