datetime

Convert string to DateTime in c#

Hi, can someone please tell me the easiest way to convert the following date created using.. dateTime.ToString("yyyyMMddHHmmss", CultureInfo.InvariantCulture) into a proper DateTime object? 20090530123001 thanks. NB: I have tried Convert.ToDateTime(...) but got a FormatException. ...

Link SQL Database to Date

I am creating a C# program which is using a SQL database. I want to link values of dates to the calendar so that I can use them in the C# program. IE: 04/01/2010 = Monday, 05/01/2010 = Tuesday... etc 11/01/2010 = Monday, 12/01/2010 = Tuesday. This in in the aim of showing a calendar view, that can be viewed in week lots, and move forwar...

Convert to UTC Timestamp

//parses some string into that format. datetime1 = datetime.strptime(somestring, "%Y-%m-%dT%H:%M:%S") //gets the seconds from the above date. timestamp1 = time.mktime(datetime1.timetuple()) //adds milliseconds to the above seconds. timeInMillis = int(timestamp1) * 1000 How do I (at any point in that code) turn the date into UTC forma...

JavaScript - find date of next time change (Standard or Daylight)

Here's a timely question. The rules in North America* for time change are: the first Sunday in November, offset changes to Standard (-1 hour) the second Sunday in March, offset changes to Daylight (your normal offset from GMT) Consider a function in JavaScript that takes in a Date parameter, and should determine whether the argument ...

Adding and subtracting dates without Standard Library

Hello, I am working in a limited environment developing a python script. My issue is I must be able to accomplish datetime addition and subtractions. For example I get the following string: "09/10/20,09:59:47-16" Which is formatted as year/month/day,hour:minute:second-ms. How would I go about adding 30 seconds to this number in P...

Conversion from String to type Date is not valid error

I have the following date as string "091020". I am using SubSonic as my DAL. When I do myObject.DateColumn = "091020" I get the error "Conversion from type String to Type Date is not valid" I tried playing with the IFormatProvider and CultureInfo but can't seem to get raid of the error. What am I missing? ...

Warning: date() [function.date]:

Does anyone know where I can read the documentation for the solution to this warning. I can search for the warning and I just get a phonebook's worth of pages that have the same problem. Anyone? Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting...

How can I get an accurate UTC time with Python?

I wrote a desktop application and was using datetime.datetime.utcnow() for timestamping, however I've recently noticed that some people using the application get wildly different results than I do when we run the program at the same time. Is there any way to get the UTC time locally without using urllib to fetch it from a website? ...

How to get the current datetime in UTC from an Excel VBA macro

Is there a way in an Excel VBA macro to get the current datetime in UTC format? I can call Now() to get the current time in the local timezone; is there a generic way to then convert this to UTC? Thanks, Jon ...

Intercept Silverlight DatePicker's convert from text to DateTime

Hi, I want DatePicker to convert the following text pieces to DateTime (shown in international format) so my customers can write a date in DatePickers textbox faster so it is not just DateTime.Parse I will use: "3" to 2009-10-03 "14" to 2009-10-14 "1403" to 2009-03-14 "140310" to 2010-03-14 "14032010" to 2010-03-14 I have tried diffe...

How to check if two DateTime's occur on the same day

Is there a better .net way to check if a DateTime has occured 'today' then the code below? if ( newsStory.WhenAdded.Day == DateTime.Now.Day && newsStory.WhenAdded.Month == DateTime.Now.Month && newsStory.WhenAdded.Year == DateTime.Now.Year ) { // Story happened today } else { // Story didn't happen today } ...

MySQL - Join Based on Date

Is it possible to join two tables based on the same date, not factoring in time? Something like: ...FROM appointments LEFT JOIN sales ON appointments.date = sales.date... The only problem is it is a datetime field, so I want to make sure it is only looking at the date and ignoring time ...

Changing GMT to EST for Time in Crystal Reports

Right now all of my times on my reports are in GMT. Anybody know how to convert this into EST? ...

Getting day number in the week in a stored procedure.

How can I get the number of a day in a week fro example: 2009-10-21 would be 4 assuming that: Sun - 1 Mon - 2 Tue - 3 Wed - 4 Thu - 5 Fri - 6 Sat - 7 I am using MySql Server 5.0.37 ...

How to implement posting limit of a user?

A user can post 4 times at most within a day. The difficulty is how to get the start of a day in database?I'm using MySQL ...

PHP simple date question

Function echo date( "m/d/Y h:i a", "10/22/2009 12:32 am" ); Output 12/31/1969 07:00 pm Why is my output not giving me the correct date, what am I doing wrong? ...

Check if DST is set for specific date and time

Hello there, i am trying to check, with plain c, whether the DST is set on a specific date and time. i have tested gmtime and localtime, but these functions only take care of the current system DST. Thanks for your advice. thomas ...

Is JavaScript's Date object susceptible to the Y2038 problem?

Assuming a 32-bit OS/Browser, could a Date object created in JavaScript rollover to 1970 if I set a date beyond 2038? The Mozilla documentation says a year can be set to 9999, however I don't know if this is consistent across all JavaScript implementations, or if this is an accurate description of what the specification dictates. I wou...

Is there a way to store and manipulate a span of time that takes month lengths, leap years, etc. into account?

I was just about to write this myself, but I know this has to exist and I'm just managing to avoid all the Google keywords that would lead me right to it. I would be looking for something like DDDMMMYYY where D, M, Y are the number of days, months, and years. So 00103000 would indicate a span of three months and one day, or 000000001 wo...

Is it ok to use ticks to pass datetime using ticks between pages of an application

I'm currently passing some date-time info to a web page using url parameters, which are ticks of date times, and then converting the ticks back into date times when I need to at the other end. Is there a better way to do this, and why. for example http://localhost:57765/dinners/updatedinner/38?startDate=633917664000000000 ...