In my business object I have to obtain the current hour (a DateTime with minutes and seconds = 0).
I have created a function like this:
private DateTime GetCurrentHour()
{
return DateTime.Today.AddHours(DateTime.Now.Hour);
}
If I use it in this way
var lastHour=GetCurrentHour();
I get a NullReferenceException
????
U...
I have a text file with lines like this:
2010-02-18 11:46:46.1287 bla
2010-02-18 11:46:46.1333 foo
2010-02-18 11:46:46.1333 bar
2010-02-18 11:46:46.1467 bla
A simple sort would swap lines 2 and 3 (bar comes before foo), but I would like to keep lines (that have the same date/time) in their original order.
How can I do this in Python?...
I got a table with some time data in the format of yyyymmddMilliseconds. For example, 20100218000051234. How to convert this into DateTime type? In SQL Server 2008.
...
In an ASP.NET page I have this:
<asp:Label ID="MyDateTimeLabel" runat="server"
Text='<%# Eval("MyDateTime") %>' />
I'd like to have it formatted like
... Eval("MyDateTime", "{0:d}") ... // Display only the date
if and only if the time part of MyDateTime is 00:00:00. Otherwise like this:
... Eval("MyDateTime", "{0:g}") ... //...
How can I convert a COleDateTime::GetCurrentTime() to a unix time stamp or more specifically I want to convert the value so I can use it in PHP with the date() function?
...
We have a Windows Mobile application written in C# (compact framework). Regional setting is set to (English) New Zealand. Time zone is set to GMT+12 New Zealand.
We store our dates in GMT/UTC format.
We have a date 2010-02-18 18:00:00 in UTC
This time in New Zealand is 7:00 am.
When we call on a datetime object
starttime = starttime...
if i have a collection of dates and values. I want to get the value that is either:
Associated to the date in the collection
if it doesn't exist, i want a linear interpolation between two points that are around the point i am looking for
ao, here is a simple example. If the collection is:
Date Value
1/1/2009 100
1/1/2010 ...
The question is simple "Say we have an integer 1 <= n <= 12,How to use strftime to display January for '1',February for '2',March for '3' and so on ... ?"
...
java.util.Date vs java.sql.Date: when to use which and why?
...
I have a Time instance curr_time with the value of Time.now and another String target_date with the value, say, "Apr 17, 2010". How do I get the date part in the variable curr_time change to the value of target_date ?
>> curr_time
=> Sun Feb 21 23:37:27 +0530 2010
>> target_date
=> "Apr 17, 2010"
I want curr_time to change like this:...
I'm converting from a local time zone to UTC so when we convert
2010-01-03T11:15:58.840+11:00 => Sun, 03 Jan 2010 24:15:58 UTC
This is technically correct but I'm having problems with the 24 hour formatting as it does. I have some BlackBerry J2ME code which is having problems parsing this date-time String using HttpDateParser.
new Lo...
I want to display a DATETIME I get from a mySQL database as a String in Javascript.
I'm using PHP to put the DATETIME into a variable: $mydatetime.
It displays fine on the PHP page, but not in my javascript function.
<?php
echo $mydatetime --> 2010-04-19 13:00:00
echo "<script language=javascript>myfunction($mydatetime);...
I'm trying to write a custom ASP.NET field validator which makes sure the input is a valid date on the format "yyMMdd".
How do I do that?
...
I'm looking for a function identical to DateTime::createFromFormat but I need it to work in an environment running a version of PHP which is older than v5.3.
Basically I need to provide a format, like you'd use with the Date() function, and I then need to parse/validate a string against that format, and return a timestamp if the string i...
Hello all,
I am saving in my DB a TimeSpan (from .NET) value as BIGINT in SQL Server (saving the Ticks property). I want to know how to convert this BIGINT value to a DATETIME value in SQL Server (not in .NET). Any ideas?
Cheers
EDIT:
I am using NHibernate to map a TimeSpan property I have, and it persists the Ticks property. I use i...
i have 2 fields in the database (sql server 08)
Dob = "05/09/1965"
license_age = 16
how do i get the number of years this person hs had licence.
so basically dim age1 = current year - (dob - license_age)
thanks
-- thanks for the answers. worked perfectly. another question based on this.
how do i find out which year he got his license ba...
similiar question to the one asked before by someone, about age and date.
I have 2 fields in sql server 2008
DOB = "01/05/1952"
licence_age = 16
how do i get the year he go his licence from this information?
...
I read with excitement the first article that popped up in google -- it was exactly my problem. I have an object model with a non-null date field, but the underlying database field was nullable, and had a null value. It was a DateTime. nHibernate set the value to .Net's Date.MinValue, then tried to save it back, yielding an error.
Th...
I have a variable, start_time:
(rdb:5) start_time.class
ActiveSupport::TimeWithZone
(rdb:5) start_time
Tue, 23 Feb 2010 14:45:00 EST -05:00
(rdb:5) start_time.in_time_zone(ActiveSupport::TimeZone::ZONES_MAP["Pacific Time (US & Canada)"]).zone
"PST"
(rdb:5) start_time.in_time_zone(ActiveSupport::TimeZone::ZONES_MAP["Pacific Time (US &...
I have the following data:
Table Name: NODE
NID | Name | Date
001 | One | 1252587739
Date is a unix timestamp. I need a query, whereby I can select only the nodes who's "Date" is older than 24 hours. Something like this:
SELECT * FROM NODE WHERE Date < NOW() - SOMETHING
Anybody know how to do this?
Does the NOW() - SOMETHING part...