How to select records from db according to date range?
I have a "LOGTS" columns with datetime data type in a table, i would like to select my records which is within the range of "Last Week", "2 Weeks Ago" and etc! How do i do this? ...
I have a "LOGTS" columns with datetime data type in a table, i would like to select my records which is within the range of "Last Week", "2 Weeks Ago" and etc! How do i do this? ...
Hi folks, I've created a query that groups production data on ISO week by using this query SELECT to_char(wid_date,'IYYY'), to_char(wid_date,'IW'), tonnes FROM production WHERE to_char(wid_date,'IYYY') = '2009' GROUP BY to_char(wid_date,'IYYY'), to_char(wid_date,'IW') The problem is that our "production weeks" don't follow the ISO ...
I have a not null sql datetime field and if my text box in the asp.net mvc app is blank, as it cannot convertt string.empty to datetime i get error. What is an elegant way of handling this situation? ...
Hello, We have a web application that produces reports. Data are taken from a database. When we ran the web application on a localized system, it blows up. We traced the problem on a DateTime.Parse(dateString); call. The dates stored in the database is somewhat dependent on the locale of the machine. On an English system, the date is...
I have a .NET 2.0 website that is periodically losing the value for the DateTimeFormatInfo.CurrentInfo.AMDesignator (or PMDesignator) property. This causes code such as Now.ToString() or even Now.ToString("dd/MM/yyyy hh:mm tt") to not properly display the AM/PM designation which then causes date validation to fail. This issue happens sp...
I am trying to figure out whether or not the current date falls within a date range using NSDate. For example, you can get the current date/time using NSDate: NSDate rightNow = [NSDate date]; I would then like to use that date to check if it is in the range of 9AM - 5PM. ...
3.Why does "jan 1st 1970" gets added in the startime field in datastore when I am doing the below statements? (hour,min) = self.request.get('starttime').split(":") #if either of them is null or empty string then int will throw exception if hour and min : datastoremodel.starttime = datetime.time(int(hour), int(min)) Although when ...
I have a utc timestamp in the IS8601 format and am trying to convert it to unix time. This is my console session: In [9]: mydate Out[9]: '2009-07-17T01:21:00.000Z' In [10]: parseddate = iso8601.parse_date(mydate) In [14]: ti = time.mktime(parseddate.timetuple()) In [25]: datetime.datetime.utcfromtimestamp(ti) Out[25]: datetime.datetim...
In Python, using calendar.timegm(), I get a 10 digit result for a unix timestamp. When I put this into Javscript's setTime() function, it comes up with a date in 1970. It evidently needs a unix timestamp that is 13 digits long. How can this happen? Are they both counting from the same date? How can I use the same unix timestamp between...
How do I get the current month as an integer, and as a string? So for this month, I would want "7" and the string "July". Is there an easy way to do this without a lot of string parsing and a lookup list for month names? ...
Hello, I am creating a form where a user will register with a struts2 application. It will be required for the user to input a date in a specific format. Since I am not going to use the datepicker ajax tag, I am using a textfield with a date tag in the form like this: <s:date name="birthDate" id="bDateId" format="yyyy-MM-dd"/> <s:te...
I have a time in EST timezone, it is done using the NOW() function on the mysql server. Because my server is located in EST, the time stored is in EST. When I retrieve it from my app on the iPhone, I need to display it in the correct time zone of the user. How do I do that? ...
I understand that seconds and microseconds are probably represented separately in datetime.timedelta for efficiency reasons, but I just wrote this simple function: def to_seconds_float(timedelta): """Calculate floating point representation of combined seconds/microseconds attributes in :param:`timedelta`. :raise ValueError:...
How to get difference between two dates in Year/Month/Week/Day in an efficient way? eg. difference between two dates is 1 Year, 2 Months, 3 Weeks, 4 Days. Difference represents count of year(s), month(s), week(s) and day(s) between two dates. ...
I have three tables. Table (t), a resource in my system. It has a maximum capacity. Booking (b), a reservation in the system, it hase FromDatimeTime, ToDateTime and nrOfPeople BookedTable (bt), connects the booking with table and how many seats that are used by this booking, a booking can have more than one table. The problem is tha...
Please help. I am trying to figure out how to use DATE or DATETIME for comparison in a linq query. Example: If I wanted all Employee names for those who started before today, I would do something like this in SQL: SQL ------ Select EmployeeNameColumn From EmployeeTable WHERE StartDateColumn.Date <= GETDATE() //Today SQL ------ But w...
I'm using bcp to import a flat file into an SQL Server 2005 database. I'm running into a problem with datetime fields. My format file field is specified as: <COLUMN SOURCE="15" NAME="DATEOFSERVICE" xsi:type="SQLDATETIME"/> My data file has dates formatted as: 19820101 However, some (many) are filled with 00000000 The 00000000 date...
Hi, I've done some simple string -> DateTime conversions before using DateTime.ParseExact(), but I have a string that I can't seem to get parsed properly. I'm probably doing something very obvious wrong but I just can't see what it is. The code is as follows: string date = "Tue Jun 23, 2009 2:23 pm"; DateTime lastupdate = DateTime.Par...
I want to convert null able datetime "DateTime?" to DateTime. But i am getting error. I have done this like following: DateTime UpdatedTime = (DateTime)_objHotelPackageOrder.UpdatedDate == null ? DateTime.Now : _objHotelPackageOrder.UpdatedDate; But i am getting error: Cannot implicitly convert type 'System.DateTime?' to 'System.Dat...
I'd like to use date time format string (possibly UTC) which is understandable and parsable on as many platforms and languages as possible? At least PHP, Python, Perl, Java, Rails and some common C++ library should be able to understand it. Which one should I use? Sample from MSDN: Culture: English (United Stat...