time

Use JavaScript to Parse Time

This is probably something easy, but I'm a bit confused how to do this. How can I, using JavaScript, parse only the time from the following ISO 8601 date string: 2009-12-06T17:10:00 In other words, with the string above, I'd like to output: 5:10 PM Any guidance/tutorials on this would be great. ...

How can the last command's wall time be put in the Bash prompt?

Is there a way to embed the last command's elapsed wall time in a Bash prompt? I'm hoping for something that would look like this: [last: 0s][/my/dir]$ sleep 10 [last: 10s][/my/dir]$ Background I often run long data-crunching jobs and it's useful to know how long they've taken so I can estimate how long it will take for future jobs....

Implementing Expiration Dates in an application?

I'd like to put an expiration date in some software I made. Obviously psuedocode: if time() > xxx: exit() All someone has to do here is set their system clock back. Anything better to do? ...

Timestamp of nearest valid month

Just a quickie.. How to derive the unixtime of nearest March or June? If the current month is February of 2009, the script should give the unixtime of March 01, 2009. If the current month is April of 2009, the script should give the unixtime of June 01, 2009. If the current month is October of 2009, the script should give the unixtime...

strtotime("next march")

Going through a weird problem here. I am trying to get the date of coming March, but it doesn't seem to work. $nextMarch = strtotime("next march"); What could be wrong with this tiny little code? This is a question related to this question: http://stackoverflow.com/questions/1872812/timestamp-of-nearest-valid-month ...

Java time-efficient sparse 1D array (double)

Hi, I need an efficient Java structure to manipulate very sparse vectors of doubles: basic read / write operations. I implemented it in a HashMap but the access is too slow. Should I use another data structure? Do you recommend any free library? Looking for some peaceful advice :) Thanks a lot, Marie ...

How to find the current biweekly period in Rails

I want to run some Find statements that only show results from the current two week period of a company - it's the pay period for the company. In other words, not necessarily just the last two weeks of records. A quick search looks like I am not going to be able to use a built-in Time method like Time.now.beginning_of_quarter or Time.n...

Best way to return array of counted values for multiple date ranges in Rails

I'm trying to return an array of counted values for consecutive date ranges (that will vary in distance), so that I have something like the following: counted_values = [2,0,4,5,6,0,0,4,2] So far I've written something that works but makes me shudder slightly, as I'm sure there's a more Rubyist/Rails way of doing it. Current code: ...

get NSDate today, yesterday, this Week, last Week, this Month, last Month... variables

what i am trying to do is to get NSDate today, yesterday, this Week, last Week, this Month, last Month variables ready for comparison for headers to be added on UITableView's titleForHeaderInSection what i want is done manually in the code below for date 2009-12-11 NSDate *today = [NSDate dateWithString:@"2009-12-11 00:00:00 +0000"];...

Is there a faster/better way to leettime?

I found leettime via twitter, and it's novel enough for me to want to mess around with it/share it with you guys. To my dismay this version doesn't do seconds. It also seems like there might be a more efficient way to generate the time, what do you think? Leet Time Now, how is this leettime calculated? For a given humanti...

Determining Millisecond Time Intervals In Cocoa

Just as background, I'm building an application in Cocoa. This application existed originally in C++ in another environment. I'd like to do as much as possible in Objective-C. My questions are: 1) How do I compute, as an integer, the number of milliseconds between now and the previous time I remembered as now? 2) When used in an obj...

Getting the current locale 24/12 hour style in Cocoa Touch

I'm trying to figure out whether or not the current locale uses a 12 hour or a 24 hour clock. I've been checking out NSDateFormater to no avail. Any leads? Thanks! ...

C++ Printing Time Only to a file!

How can I print only the current time (not the date) to a file? I need it in this format... 13:55:36 I've tried a few different ideas but they all include the date too. ...

Save Client side time in database

Hi All I am developing an application, i need date and time of the user who is accessing(ie Client's date time), how can i get it to server side........? ...

What is a better solution for save client machine time on server?

Hello All I need to save client machine time when he log in on my web application.For this i have 2 solution Using javascript Store the server time System.DateTime.Now.ToUniversalTime(); and ask the user in which timezone he is in TimeZoneInfo indTimeZone = TimeZoneInfo.Local; return TimeZoneInfo.ConvertTimeFromUtc(date, TimeZon...

Does the method System.currentTimeMillis() really return the current time?

Hi there! Based on ideas presented in link I implemented several different "sleep methods". One of this methods was the "binary sleep", which looks like this: while (System.currentTimeMillis() < nextTimeStamp) { sleepTime -= (sleepTime / 2); sleep(sleepTime); } Because the check if the next time step is already reached takes place at...

Processes timing

How to calculate the total execution time of each application Win (process) with the group on day. For example: the process - notepad.exe - 10 minutes today (in total) ...

C++ convert decimal hours into hours, minutes, and seconds

I have some number of miles and a speed in MPH that I have converted into the number of hours it takes to travel that distance at that speed. Now I need to convert this decimal number into hours, minutes, and seconds. How do I do this? My best guess right now is: double time = distance / speed; int hours = time; // double to integer con...

python time(milli seconds) calculation

How to calculate milliseconds,from the code below. a = datetime.datetime.now() b = datetime.datetime.now() c = b - a >>> c >>> c.days 0 >>> c.seconds 4 >>> c.microseconds Thanks.......... ...

Java Date cut off time information

Hi Folks, I have a Java Date object containing date and time information, e.g. 2008-01-01 13:15:00. I want to write a method that cuts off the time information so I only have the date left, e.g. 2008-01-01 00:00:00. Do you have a tip? I tried doing something like this (timestamp / (24 * 60 * 60 * 1000)) * (24 * 60 * 60 * 1000) but I ...