datetime

Why my print current date time (C language) gives different answer

I want to get the current date (day, mon and year). I found out there are some functions in C to do that like ctime (get the string of time), localtime and gmtime. I tried with following code but the output are different. I get this output: The date and time is Tue Apr 20 2010 (which is correct) The year is : 110 The year is : 110. D...

Searching temporal data

I developing an application (in C#) where objects are active under a period of time, they have from and to properties of DateTime-type. Now I want to speed up my search routine for queries like: Are there other active objects in this timeperiod/at this time. Is there any existing temporal index I can use or can I use QuadTree/other tre...

How to override C# DateTime serialization with class auto-generated from wsdl?

I have a WSDL that the consumer of my web service expects will be adhered to strictly. I converted it into an interface with wsdl.exe and had my web service implement it. Except for this problem, I have been generally pleased with the results. A simple GetCurrentTime method will have the following response class generated from the WSD...

how to calculate the 4 days before date of the target date

i have two dates ValidFrom : 20-04-2010 validTo : 02-05-2010 i need to know 4 days(date) before the validity expire .how to calculate the 4 days before date of the validity expire date 02-05-2010 ...

Find Month difference in php?

Is there anyway to find the month difference in php? I have the input of from date 2003-10-17 and todate 2004-03-24. I need the results how many month is there within these two days. Say if 6 months, i need the output in months only. Thanks for guide me for day difference. I find the solution through mysql but i need in php. Anyone hel...

DateTime: Require the user to enter a time component

Checking if a user input is a valid date or a valid "date + time" is easy: .NET provides DateTime.TryParse (and, in addition, VB.NET provides IsDate). Now, I want to check if the user entered a date including a time component. So, when using a German locale, 31.12.2010 00:00 should be OK, but 31.12.2010 shouldn't. I know I could use Da...

time calculation within LINQ

Hi I want a linq query to return a calculated timespan, i have used the timespan function before, but im not sure how to incorporate it into linq. Basically the linq is returning a datetime field which i want to subtract from the current datetime to get days and hours. Any help appreciated! Thanks ...

C# DateTime, is this method regional setting safe?

I am using the following method to serialize a date as a string private const string DateFormatString = "dd.MM.yyyy HH:mm:ss"; string LastsuccessfuldownloadDateTime = DateTime.Now.AddDays(-91).ToString(DateFormatString); Is this the safest way to ensure that the string always gets serialized in this format? Update on one server I hav...

new Date().getTime() in .NET

Basically i want to do the below in .NET but i have no idea how to. var d = new Date().getTime() + " milliseconds since 1970/01/01" ...

Looping through the days of the week inside of C# TimeSpan Class

Hi, I'm trying to loop through EACH DAYof the WEEK between 2 time periods DateTime start = new DateTime(2010, 1, 1); DateTime end = new DateTime(2011, 12, 12); I have managed to get the number of days between these dates using the following code TimeSpan range = (end - start); turn out to be 710. I am now looking to get ...

How to generate a random date and time between two dates?

The title pretty much says it all. Don't overlook the 'date AND TIME' part though. ...

Timestamp on Windows similar to Unix timestamp and file manipulations

I am aware that linux has timestamp info available to prog. langs. which is very handy. I m developing a program and i need to append date time to the created file. and it should be unique. Later on I want to parse the files, but i want to parse the latest one only. Is there such option in .net like timestamp in *nix systems? Any ex...

How to push a datetime var or a demical var to a .NET SOAP server using PHP?

I am sending all the parameters needed to the SOAP server, but they require one of the params to be a decimal and one to be a datetime. I can't figure out how to convert a string to either type. <?php $params = array( # this converts the string to an int 'int' => (int) '123', # to datetime is a big ? to me 'day' => date("n/j/Y...

Using DateTime in PHP, generating bad unix epoch time from $foo->format('U')

I can't seem to get the correct Unix epoch time out of this PHP DateTime object. $startingDateTime = "2005/08/15 1:52:01 am"; $foo = new DateTime($startingDateTime, new DateTimeZone("America/New_York")); echo $foo->format('U'); which gives 1124085121 Which is Mon, 15 Aug 2005 00:52:01 GMT -500 (according to http://w...

How would you convert secs to HH:MM:SS format in SQLite?

How would you convert secs to HH:MM:SS format in SQLite? ...

Convert String to datetime Format

Need to convert a string to normal datetime format so it can be correctly inserted onto a datetime type field. String Format: 4/21/2010 4:43:03 PM Example: 2010-04-21 16:43:03.000 I have clarified question: The need is to change format and not type. ...

Get a list of the last 10 Mondays

Hi folks, I wanna have a drop down that lets me select "Week Commencing Monday the 20th" going back 10 Mondays but I'm not sure how to go about doing this. I've used date.now(), etc. before but not sure how to do this one. Thanks, Billy UPDATED CODE Public Sub GetMondays() Dim dtMondays As New DataTable() dtMondays.Columns.A...

Convert int to datetime

how can i convert a field contain data 733803 as into be datetime on sql server? ...

Why date comparison in sql is not working. Please help

I am trying to fetch some records from table but when i use OR instead of AND it returns me few records but not in other case. dates given exactly are present in table. What mistake i am doing ? select newsid,title,detail,hotnews from view_newsmaster where datefrom>=CONVERT(datetime, '4-22-2010',111) AND dateto<=CONVERT(datetime, '...

What is the point of Convert.ToDateTime(bool)?

I was doing some type conversion routines last night for a system I am working on. One of the conversions involves turning string values into their DateTime equivalents. While doing this, I noticed that the Convert.ToDateTime() method had an overload which accepted a boolean parameter. First question? Under what circumstances could t...