Hi there, I was searching here about converting a string like "16:20" to a DateTime type without losing the format, I said I dont want to add dd/MM/yyy or seconds or AM/PM, because db just accept this format.
I tried with Cultures yet
Thanks in Advance
Added Angel says "I am using C#".
...
Anyone done this and can share? I see an option or two but want to know what others have accomplished.
...
Using NUnit 2.2 on .NET 3.5, the following test fails when using DateTime.Equals. Why?
[TestFixture]
public class AttributeValueModelTest
{
public class HasDate
{
public DateTime? DateValue
{
get
{
DateTime value;
return DateTime.TryParse(ObjectValue.ToStrin...
If I wanted to work using dates and time going millions of years into the past/future how would I do it in C/C++/C#?
For example say I was working on an algorithm to see if a comet was going to hit the earth? Are there commercial or open source libraries that do this?
Most DateTime values only work for a few years. Unixes will run out...
I doubt I am the only one who has come up with this solution, but if you have a better one please post it here. I simply want to leave this question here so I and others can search it later.
I needed to tell whether a valid date had been entered into a text box and this is the code that I came up with. I fire this when focus leaves the...
i'm using a DateTime in C# to display times. What date portion does everyone use when constructing a time?
e.g. the following is not valid:
//4:37:58 PM
DateTime time = new DateTime(0, 0, 0, 16, 47, 58);
because there is no zero-th month or zero-th day.
Do i use COM's zero date?
//4:37:58 PM
DateTime time = new DateTime(1899, 12, 3...
The best I can come up with for now is this monstrosity:
>>> datetime.utcnow() \
... .replace(tzinfo=pytz.UTC) \
... .astimezone(pytz.timezone("Australia/Melbourne")) \
... .replace(hour=0,minute=0,second=0,microsecond=0) \
... .astimezone(pytz.UTC) \
... .replace(tzinfo=None)
datetime.datetime(2008, 12, 16, 13, 0)
I.e., in ...
I need a simple SQL to accomplish the below:
Problem:
When a petrol bunk runs out of fuel, the admin makes note of the DateTime (RunOutDate) when it ran out of fuel and notes also the DateTime (ResupplyDate) when the fuel supply was back on.
I need to create a report on how many days the bunk ran out of fuel.
eg.
1/1/1 10:10 to 1/1/...
.
echo date('r',strtotime("16 Dec, 2010")); //Tue, 16 Dec 2008 20:10:00 +0530
echo date('r',strtotime("16 Dec 2010")); //Sat, 16 Jan 2010 00:00:00 +0530
That's just wrong... Either it should fail or it should parse correctly. Do you know any robust natural language date/time parser in php? How do you parse natural language date ti...
By default C# compares DateTime objects to the 100ns tick. However, my database returns DateTime values to the nearest millisecond. What's the best way to compare two DateTime objects in C# using a specified tolerance?
Edit: I'm dealing with a truncation issue, not a rounding issue. As Joe points out below, a rounding issue would introd...
I am getting this error on a remote server, but the same code executes fine locally. Please refrain from saying it sucks, or giving me your rant on dynamic sql, I didn't write it, just trying to figure out why it's throwing an exception. The highlighted error is line 56.
Protected Sub drpDateRange_SelectedIndexChanged(ByVal sender As Ob...
How do I get a DateFormat of some sort to throw an exception if I try to parse an illegal date? If I parse a date like "99.99.9999" with a SimpleDateFormat with the pattern "dd.MM.yyyy", no exception is thrown, but this is clearly not a valid date.
...
I have a ticks value of 28000000000 which should be 480 minutes but how can I be sure? How do I convert a ticks value to minutes?
Thanks
...
Hi there, im trying to show a 24 hours format using this line:
Text='<%# Bind("Appointment", "{HH:mm}")
So how it'll be formated for showing for example 16:40 instead 4:40 ? thanks in advance
...
Currently, I'm working on a project to manage maintenance windows on a database of servers, etc. Basically, I only need to be accurate down to the hour, but allow for them to be set to allow, or disallow, for each day of the week.
I've had a few ideas on how to do this, but since I work by myself, I'm not wanting to commit to anything w...
What is the best method to determine if the current time is AM or PM using VB.NET?
Currently I'm using If Date.Today.ToString.Contains("AM") but I'm sure there is a better method.
Good <%If Date.Today.ToString.Contains("AM") Then Response.Write("Morning") Else Response.Write("Afternoon")%>
...
I have a DATETIME field. I would like to select all the records that have been updated in the last week. Right now I'm using this query:
SELECT SUM(mins_spent) as time_sum FROM todos WHERE
lastUpdate >= '2008-12-22' AND lastUpdate <='2008-12-28'
But the results i get seem to be different depending on time of the day, e.g on 7 PM I mi...
Hey, I stumbled upon this site looking for solutions for event overlaps in mySQL tables. I was SO impressed with the solution (which is helping already) I thought I'd see if I could get some more help...
Okay, so Joe want's to swap shifts with someone at work. He has a court date. He goes to the shift swap form and it pull up this week'...
If I have a certain week number (eg 51) and a given year (eg 2008), how do I find the date of the first Monday of that same week?
Many thanks
...
I am creating an xml schema, and I want to support a custom date format:
Thu Dec 11 14:17:20 2008
Currently I'm using the following pattern type:
<xs:simpleType name="Date_Type">
<xs:restriction base="xs:token">
<xs:pattern value="(Sun|Mon|Tue|Wed|Thu|Fri|Sat) (Jan|Feb|Mar|Apr|May|June|Jul|Aug|Sep|Oct|Nov|Dec) [0-9]{2} [0-9]{2}:[0...