Jump to content

Javascript date/time/manipulation...


Aureole

Recommended Posts

I'm creating a little Grease Monkey add-on for Firefox, for a Website that shows all times in PST. I want to search for all instances of:

 

<li class="date">*</li>

 

Then replace the date/time there-in with a new date, depending on the user's time-zone.

 

An example of what the date looks like is "02.04.2008 11:10 AM PST" i.e.:

<li class="date">02.04.2008 11:10 AM PST</li>

 

I REALLY don't know where to start. Is this even possible? If someone can help me out then it'd be much appreciated.

 

Normal Javascript is fine, however if you feel it'll make your life easier and you are familiar with it, then jQuery would be great.

Link to comment
Share on other sites

But surely Javascript can turn something like "02.04.2008 11:10 AM PST" into a time-stamp, then that time-stamp can be manipulated? I only need to turn the above into a time-stamp, then I will be able to achieve what I want to do; despite what you say.

 

The script I'm writing only needs to convert to one time-zone, it could be a simple var... with the time-zone... then all it has to do is add ( subtract) a certain amount of seconds to (or from) the time-stamp.

 

It's hard to explain, but if I can turn "02.04.2008 11:10 AM PST" into a time-stamp then the rest I can figure out myself.

 

Any ideas?

Link to comment
Share on other sites

emehrkay the reason I said that is because Aureole was saying he/she was going to be able to do this no matter what I say. The javascript date functions can not accurately find the time zone of a person's current location. You need to use severs side scripting to accurately find times zone; as in PHP 5+ Time Zone Date And Time Function. I did not know original that Aureole wanted to convert a static date into another format; I thought he/she was trying to get the time zone for each web page visitor's location with javascript only.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.