Can Ruby do something like this?
irb(main):001:0> start = Time.now
=> Thu Nov 05 01:02:54 -0800 2009
irb(main):002:0> Time.now - start
=> 25.239
irb(main):003:0> (Time.now - start).duration
=> "25 seconds"
(the duration method doesn't exist now)... and similarly, report
23 minutes and 35 seconds
1 hour and 33 minutes
2 days and 3...
Is there a cross-platform function in python (or pytz) that returns a tzinfo object corresponding to the timezone currently set on the computer?
environment variables cannot be counted on as they are not cross-platform
...
I want current time in following format in a string.
dd-mm-yyyy HH:MM
How?
Thanks in advance.
Sagar
...
I am running on a Win2003 server, TimeZone set to (GMT -06:00) Central Time. I am programming with VS.NET 2005, f/x 2.x. When I execute the following code I do not get the expected results - but only when it is on the PROD server. Any other machine appears to work correctly.
_response.Timestamp = DateTime.Now;
Is there a setting hi...
I have created an application.in the app i start a countdown timer and save current date as double value in database also i save end date according to countdown timer .after closing and return to app i get time form database find the difference between current date and start date and set the countdown according to that.but a problem occu...
I have an EJB 2.1 entity bean that queries a "date of birth" column in an Oracle table. The column in the database is of type DATE. The query works without problems except for one specific date: 01 may 1916.
This has something to do with daylight savings. Oracle stores the date as: 5/1/1916 1:00:00 AM, while the time of all other dates...
How can I get the last day of the month in PHP?
Given:
$a_date = "2009-11-23"
I want 2009-11-30; and given
$a_date = "2009-12-23"
I want 2009-12-31.
...
I'd like to get an 'end date' from a given 'start date' in PHP. End date is based off the start and are calculated as follows:
If Start date is from the 1-15th of the month, End date is the 15th of the following month.
If Start date is from the 16-31 of the month, End date is the last day of the following month.
eg: $start_date = '20...
The examples for Cache.Add uses DateTime.Now.Add to compute the expiration, i.e. it passes:
DateTime.Now.AddSeconds(60)
as the value of the absoluteExpiration parameter.
I'd have thought that computing it relative to DateTime.UtcNow would be more correct [as there is no ambiguity if Daylight Savings Time starts in the intervening ti...
Consider:
now = datetime.datetime.now()
now
datetime.datetime(2009, 11, 6, 16, 6, 42, 812098)
How would I create a new datetime object (past) and minus n values from the hours?
...
I have written a service that monitors a file drop location for files from a scanner. The scanner drops all files with the exact same file name (eg. Test.tif) unless that file already exists and then it appends on a timestamp on the end (eg. Test_0809200915301900.tif).
So when I process these files I attach a 'tag' to the db entry to r...
I have a "bill_date" field that I want to be blank (NULL) until it's been billed, at which point the date will be entered.
I see that MySQL does not like NULL values in datetime fields. Do any of you have a simple way to handle this, or am I forced to use the min date as a "NULL equivalent" and then check for that date?
Thanks.
EDITED...
Sometimes I have a datetime or timestamp columns in the database and, for example, I need to select all records with timestamp updated today.
I usually do it like this:
SELECT * FROM mytable WHERE CAST(TS AS DATE) = CURDATE();
SELECT * FROM mytable WHERE CAST(TS AS DATE) = '2009-11-01';
Also, it's possible to use DATE() function ...
What I want to do is convert an epoch time (seconds since midnight 1/1/1970) to "real" time (m/d/y h:m:s)
So far, I have the following algorithm, which to me feels a bit ugly:
void DateTime::splitTicks(time_t time) {
seconds = time % 60;
time /= 60;
minutes = time % 60;
time /= 60;
hours = time % 24;
time /= 24;...
Hi
I would like to convert a yyyy-mm-dd to something like this:
"Saturday, 2 October 2009"
I would like also to have the option to modify the language both day of the week and month (make it customizable)
thanks in advance ;)
...
How do you convert a python time.struct_time object into a datetime.datetime object? I have a library that provides the first one and a second library that wants the second one...
...
I love the new DATE datatype in SQL Server 2008, but when I compare a DATE field to a DATETIME field on a linked server (SQL 2005, in this case), like this:
DECLARE @MyDate DATE
SET @MyDate = CONVERT(DATE, GETDATE())
SELECT *
FROM MySQL2005LinkedServer.SomeDB.dbo.SomeTable
WHERE SomeDatetimeField < @MyDate
I get this error:
OLE D...
Hi,
I'm currently working on some DateTime properties in a PropertyGrid in c#.Net. Im using the default drop-down datetime picker.
My question: Is there any way to show the full date with the time? By default the date is shown if no time is set, but I want zero-values aswell. I.e: I want "09.11.2009 00:00" to be shown instead of "09.11...
Hi,
I'm just starting to think properly about rolling out a webapp that will need to do things to users at the start of their day, say 6am. Also at the end of their days.
Everywhere I've been reading about people saying a lot just to use .ToUniversalTime to store the time in UTC, but when I tried this (as I suspected) it didn't work, a...
Ok, so I need to find the date of Monday this week programmatically.
For example, for this week Monday was on the 9th, so the date I need is: 09/11/2009
And when we roll over to next week it needs to calculate: 16/11/2009
I have tried doing this myself but I can't see how to do the arithmetic, thank you.
...