datetime

Handling a DateTime DBNull

I have seen many, many versions of this on SO, but none of them seem to quite work for my needs. My data comes from a vendor database that allows null for DateTime fields. First I pull my data into a DataTable. using (SqlCommand cmd = new SqlCommand(sb.ToString(), conn)) using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fil...

to compare date and time fields which is in the format dd-mm-yyyy hh:mm:ss

Please do help me out . starttime and endtime will be provided in dd-mm-yyyy hh:mm:ss as input. (6-14)hr ,(14-22)hr,(22-6)hr are the three different shifttimes . a machine's downtime(starttime and endtime) can be in any of the above shifttimes. forex :starttime:24-03-2010 14:00:00 endtime:25-03-2010 24:00:00 now the downtime durat...

"Simple" C# Time Thread Appears to be Freezing

I've been staring at this thread for some time and I believe my mind has shut down on it. Thinking that the best thing to do, in order to update the time in a UI TextBox, would be to create what I thought would be a simple thread to get the time and post it back to the UI control. After having fought with it for a while, I'm getting fr...

how can i remove the value from a DateTime?

i have an existing DateTime? object that has a datetime in it. I want to remove the datetime value from it so when you ask "HasValue" it returns false? ...

SubSonic 3.0 translate dates to UTC

Is there a way in subsonic 3.0.0.4 using the ActiveRecord scheme to automatically translate dates to and from UTC so that my database will have dates in UTC, but the users will see local time? I've read about a 'useUtc' config option, but it looks like this doesn't exist in version 3. What is the best way to do this in version 3? ...

NHibernate Delete with date arithmatic using HQL

Hello, I've looked around and can't find too much. But is it possible to do something like this using HQL in nHibernate: Session.CreateQuery(@"DELETE FROM MyObject mo WHERE (mo.AlteredDate + mo.ExpiryDetails.ExpiryTimestamp) < :pNow") .SetDateTime("pNow", DateTime.Now); So basically I want to...

Display past dates before the year 1800

I have a system for history events. It's showing the date using this date("j F, Y", strtotime($row['dated'])); But when I try: 21 Oct 1877, it's showing 31 December, 1969. How can I fix this problem? ...

How to check the time and date online ?

hi i am making an app in which user sends xml to server and get response.... now i have to save the date and time of sending and response of that request....for this should i use iphone's date or check it online? because my thinking is that the iphone's date and time may not be correct.....always...so it is better to check the time on...

What is this time format?

I am being returned this time format from an API: 1287498792000 Can anyone advise what format that is and how I would parse it in PHP? ...

question on DateTime addtime in c#?

is there a function that would do this DateTime1.minute=50 if i add 10 minutes it would add 1 hour and set minute to 0 and likewise ...

PHP DateTime Inconsistency? What am I missing?

Using PHP 5.2.5 I was working with some DateTime objects and noticed a time that seemed off. The problem I'm having may be related to timezones, but I'm not sure - I'm creating a DateTime from a Unix Time Stamp and getting different/unexpected results depending on how I output it. I created the following to easily illustrate the "issue...

Is there a DateFormatProvider that will use Windows localization information?

I'm writing a java gui application that has to display dates. Since this application is primarily going to run on Windows systems, I would like to be able to use date & time formats that correspond to the Windows localization settings. I found DateFormatProvider class, in Java 6, which gave me high hopes ... but I haven't found an impl...

ASP.NET WebService: don't complain on a date format

One of the field in my web service method accepts DateTime value. Once service user provided value in wrong format: "31-10-2010" (or probably it was "31-10-10", to be honest: I not sure, are implementing logging right now). It is "dd-mm-yyyy" instead of "standard XML datetime been "yyyy-mm-ddTHH:MM:SS". The problem that instead of rejec...

Date formatter is not formating the date correctly.

I wrote this following java code to format the date and time in specific formats.You can see the below code at ideone . import java.util.Calendar; import java.util.GregorianCalendar; import java.text.SimpleDateFormat; class timeAndDateTransformation{ public static void main(String[] argv){ Calendar newDate = new Gregoria...

In IPhone(Objective C) how do I get the current date formatted in miliseconds to send to a server Rest Web Service?

Hi, I am new to IPhone development. I need to take the current date from device and send to a server in JSon format. The server expects this date to be in milliseconds as since January 1, 1970, 00:00:00 GMT(Unix time) . I have noticed IPhone has some methods to get the current time in SECONDS, well, should be very easy to transform se...

How to persist DateTime Kind while storing a datetime object into a data table?

Hi, I’m facing an issue with storing the DateTime object into a datatable, it looses the Kind information set into it.For example if the DateTime.Kind is UTC, once I assign it to the datarow value it changes the Kind to Unspecified.Please find the code below. public class LocalTimeToUtcConverter { public DateTime Convert(Da...

Get current computer datetimeformat

Hi I am new to web programming and I have an mvc app which runs on azure. There is a functionality where users can export grid data to csv and one of the fields is a datetime field. When the user clicks on export I take whatever is in the grid, format it to csv and then return a FileContentResult. The problem I have is that since the con...

Calendar always shows 7:00 no matter what the data in the table says - Basically the variable is always set to 7:00.

Hi Guys, I have a table with data exactly like this: ID Heading Description Time Location Start_Date End_Date 63 Wed Serv Small group 19:00:00 null 2010-10-13 null 70 Fall Harvest Calvary null Pepin, Wi 2010-10-30 null My Calendar shows the events on the correct dates, but the ti...

c#: whats the easiest way to subtract time?

Hey guys, ive seen a couple posts on this but nothing so far that is specific to this simple operation. I'm trying to put together a tool that will help me make work schedules. What is the easiest way to solve the following: 8:00am + 5 hours = 1:00pm and 5:00pm - 2 hours = 3:00pm and 5:30pm - :45 = 4:45 and so on. ...

c#: initialize a DateTime array

Hey guys, im a bit lost on how to do this. I know how to initialize an array with values at the time of declaration, but how would i do it with a DateTime type array since it takes multiple arguments to create a date?? ...