I have a simple comparison in my view to see if an event is in the past:
<% if (model.EventDate < DateTime.Now)
{ %>
<td style="color: red;">
<% }
else
{ %>
<td>
<% } %>
This works fine on my dev machine, running via Cassini, but on the server it seems to be interpreting 01/12/2010 as Dec. 1, not Jan 12.
Ho...
DateTimes are usually some number of ticks from some starting date. These are usually displayed by some type of tool such as a calendar or the like. It seems to me that sometimes an application would like to store a DateTime with a special meaning, like "When evaluated" or "Never" or "Unknown".
For example I worked in a company where ...
i have a column in my sql server 2005 table that should hold the number of months an employee has been in service. Since i also have the date the employee was engaged, i want the "months_In_Service" column to be a computed column. now if i use datediff(month,[DateEngaged],getdate()) as the formula for the months in service computed colum...
How can I convert the following strings to a System.DateTime object?
Wednesday 13th January 2010
Thursday 21st January 2010
Wednesday 3rd February 2010
Normally something like the following would do it
DateTime dt;
DateTime.TryParseExact(value, "dddd d MMMM yyyy", DateTimeFormatInfo.InvariantInfo, DateTimeStyles.None, out dt);
but...
I am in the process of stripping down some code I've written for a Time Frame selector function that filters search results based on a selected Time Frame (Last Month, Last Quarter & Last Year) by hiding all irrelevant results based on when they were created. The function is called by a GET variable submitted on form submit ?time_frame_q...
I want to receive the newest item from a collection. Each item has an DateTime field (EditDate) and I do a little query like that.
var s = from l in OCollectionAgents
where l.IDOfVehicle == agent.IDOfVehicle
orderby
agent.EditDate ascending
select l;
After the query I do
agent.DetailInformationOfResults.NewestAgentEdi...
Is there a way to get the offset time zone for a given date.
For example, if I am in New York and I pass in 12-12-2009 4 PM I would get back "-4" as we are 4 hours off GMT.
(In .NET land there is a function to do that off the DateTime class. So I'm guess Cocoa has it too?)
Ian
...
I'm writing a multi-threaded program that needs to be able to check if a row requires updating and act accordingly.
I had problems using the built in date/time functions of MySql and so decided to just store the "lastupdate" timestamp as an integer in the table. However, I'm having problems converting this timestamp to time_t so that I...
Hello good people! :)
As the title states, I want to get the difference (in seconds) between 2 (specifically between now and a date in the past) dates without using: strtotime, the Zend Framework or a PEAR package.
I don't want to get into the details of my reason but the gist of it is that I'm working with very old dates (and I do mea...
Hi, I have an issue with parsing a date during a unit test run, but I cannot reproduce it.
To make it more interesting it fails when the test is run by a continuous integration process but succeeds when run within Visual Studio, and they both run on the same machine, although with a different user.
Here's the test:
[Test]
public void T...
I think this is a really, really simple question but I can't seem to find the answer.
I'm trying to set default values for properties in a PHP class and one of them is a date so I'm trying to use the date() function to set it:
<?php
class Person
{
public $fname = "";
public $lname = "";
public $bdate = date("c");
publ...
I am working on a project that involves converting data into dos date and time. using a hex editor (Hex Workshop) i have looked through the file manually and and found the values I am looking for, however I am unsure how they are calculated. I am told that the int16 value 15430 corresponds to the date 06/02/2010 but i can see no correlat...
Why I can't subtract two time object? 12:00 - 11:00 = 1:00
from datetime import time
time(12,00) - time(11,00) # -> timedelta(hours=1)
Actually
TypeError: unsupported operand type(s) for -: 'datetime.time' and 'datetime.time'
...
Hi guys,
I want to convert a DATETIME field (DateOfBirth)... When I execute the following query it says invalid syntax near convert
SELECT e.Emp_Id,e.Emp_Name,e.Address,e.Department,
(convert(varchar, e.Date_Of_Birth, 103) as Date_Of_Birth) from Employee as e
But when I execute the below query it gives result but my dateofbirth colu...
For the purpose of organizing streamlined database timer-based polling, with every updating of database table I need to update a timestamp field in a SQL Server 2008 database (then poll, read its value, compare with the value in front-end and making decisions about reading the whole table).
Regarding all this, how I could read system ti...
I need to get a file creation date&time using python. I tried:
os.stat(r"path")[ST_CTIME]
But it is returning:
1263538277
This is not the creation date time. Is there a way to do it?
...
ok i need a pop up box to select date and time... but im having some trouble...
i used first modal popup (ajax) for the popup...
that is working but not looking neat...
then i put a textbox in it with the calender extender...
the problem here is when i click on textbox calender pops up but it does not seem to work because nothing is...
Hello,
I have to validate the format of a date string coming from a csv file. I use the csvReader(au.com.bytecode.opencsv.CSVReader) parser. Below is the code I use to get the data from the csv reader and change it to a date format.
def String strToDate = csvrow[monatVal]
myDate = new Date().parse("dd.MM.yy HH:mm",strToDate)
The pro...
Code would be nice but a point in the right direction is good as well.
CPAN? RegEx?
I've seen both ways
"yyyy-MM-dd'T'HH:mm:ssZ";
"yyyy-MM-ddTHH:mm:ssZ";
...
I'm reading Uncle Bob's "The Craftsman" series, and have gotten to #29 (PDF). In it, there's this snippet in test code, for asserting dates are close enough:
private boolean DatesAreVeryClose(Date date1, Date date2) {
GregorianCalendar c1 = new GregorianCalendar();
GregorianCalendar c2 = new GregorianCalendar();
c1.setGregorianCha...