datetime

How to get All Dates in a given month in C#

Hello All , I want to make a function that take month and year and return List<DateTime> filled with all dates in this month. any help will be appreciated Thanks in Advance ...

How do I convert from unix epoch time and account for daylight saving time in C#?

I have a function that converts from unix epoch time to a .NET DateTime value: public static DateTime FromUnixEpochTime(double unixTime ) { DateTime d = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); return d.AddSeconds(unixTime); } Where I am (UK) the clocks go one hour forward for summer time. In Python I get the local Ep...

C# Writing Time Through Two Dates as String

I have a begin and start DateTime for a conversion that gets logged at the start and end of this event. I then generate a report that lists a bunch of information about the event including its runtime. I have a column for total time elapsed (in days) and a date representation of start and stop. Everything is in days, I don't care abou...

Schedule Task : 6 months from now

Hi guys, I'm tryin' to find a way (from a batch file) that I can use to create a scheduled task that will execute 6 months from now. I've looked all over the net, and I'll I've come across is AT and SCHTASKS that will schedule the task monthly .. I'm looking for a solution that will execute this task every 6 months. I know this will r...

Manipulating the DateTime object in Google app engine

Hi! I am making a blog and store the publishing date of a blog post in the datastore. It looks like this: post.date = datetime.datetime.now() It now displays like: 2010-10-04 07:30:15.204352 But I want the datetime to be displayed differently. How (and where) can I set that how the date is displayed? I'd like to set the date format l...

In .net, knowing the week number how can I get the weekdays date?

I want to create a function in C# which for a week number will return me the days, in that week. For instance for week number 40, how can I get the days: 4/10, 5/10, 6/10, 7/10, 8/10, 9/10, 10/10. Thank you in advance! ...

Error when comparing two DateTime objects in Ruby on Rails

I'm comparing two DateTime objects (at least I think I am, they look slightly different in the console output below). p DateTime.now p current_user.created_at #schema.rb states that this is a datetime field difference = DateTime.now - current_user.created_at p difference Console output Mon, 04 Oct 2010 22:56:32 +1000 Sat, 14 Aug 2010...

Convert INT to DATETIME

I am trying to convert a date to datetime but am getting errors. The datatype I'm converting from is (float,null) and I'd like to convert it to DATETIME. The first line of this code works fine, but I get this error on the second line: Arithmetic overflow error converting expression to data type datetime. CAST(CAST( rnwl_efctv_dt AS I...

Too many arguments error

Hi i'm getting an error when using this code Session("formatdate") = Left(drv.Row("booking_status"), 10) Session("formatdate").ToString("dd-MMM-yyyy") Can anyone suggest anything? I'm trying to convert my session to a friendly date format but it won't work This is the error Too many arguments to 'Public Overridable Function ToStri...

C#: Check Actual Date Online?

How can I check the actual date and time by using an internet connection? I would like to receive the response from the server as a simple string; I don't want to parse an HTML response. ...

Average time from DateTime dataset in SQL Server 2005

I am trying to get the avg time a driver completed a delivery stops at each unique customer. I am using the following columns: Name (varchar(50)) Reference1 (varchar(50)) CompletedTime (Datetime). I am getting an avg but it includes the date & time NOT just date. Which is making the time avg incorrect. thanks for the help! Current...

Objective C / iPhone - How does the Date Time Picker format its dates (e.g. strips YYYY) AND how do I retrieve these formats?

When using the Date/Time picker on the iPhone/iPad, the year (yyyy) is stripped from the Date formatting in order to make room for the time. How does it accomplish this based on the default unicode formats stored by the region format? The formats do not necessarily match any of the following: NSDateFormatterLongStyle NSDateFormatterSho...

How do you handle NULLs in a Date field through your C# code?

I am currently setting the date field to a Datetime.Now which is being done through the SQL query on the database. I do a SELECT NVL(mydatefield, sysdate) FROM myView; This is not the most elegant approach I can think of. The better practice would be to check for a NULL. I found that the DateTime class does not support the syntax th...

ColdFusion 7/8 Varied Timezones

This problem makes me really sad. I'm working with a pretty archaic web application with an eclectic mix of programming languages. Previously, it stored any and all datetimes in a Datetime field in our MySQL database. Until now, everything has been done in server time, which happens to be US/Pacific. I was tasked with adding "Timezone fu...

about python datetime type

What's the equivalent type in types module for datetime? Example: import datetime import types t=datetime.datetime.now() if type(t)==types.xxxxxx: do sth I didn't find the relevent type in types module for the datetime type; could any one help me? ...

C++ : convert date/time string to tm struct

Consider this somewhat of a follow up to this question. Essentially, the C++ date/time formatting facilities seem to be hopelessly broken - so much so that in order to do something as simple as convert a date/time string into an object, you really have to resort to either Boost.Datetime or good old C strftime/strptime facilities. The...

Detect format Date

Hi, Is there a way, a good way, to test if a string than I want to transform in DateTime is dd/MM/yyyy or MM/dd/yyyy ? Thanks, ...

Convert database field to time format

I'm trying to make my string a nice formatted time but the column in the database isn't set up as a date/time field is there anyway I can do this? Here's my query Dim query as String = "Select * from openquery (devbook, 'SELECT wb.arrival_time FROM web_bookings wb ')" And here's where i'm converting it Session("formattime") = DateTi...

How to apply difference in DateTime to a list of DateTime objects in c#

I have some code which detects when properties are changed on objects, which are persisted to the db. The detection happens before they are saved back to the db. I want to know the best way to apply the change in time to a whole set of related log items. Say I have an item with a datetime of 01/01/2000 00:00:00 and I change it to ...

how to delete data from table that has date prior to 2006

I want to delete all data from a table that has a date prior to 01/01/2006 I am trying this: delete from table_a where to_char(last_update_date,'MM/DD/YYYY') < to_char('01/01/2006', 'MM/DD/YYYY') But this is not working. What is the best way to compare date's in sql? ...