Where in code should conversions be done? client, server, business, or db?
We currently do conversions of timezones and unit of measure in our database and the performance is killing us and would like to move the logic. Where do you think the best location for this is?
Thanks
...
Why doesn't the following work (Python 2.5.2)?
>>> import datetime
>>> class D(datetime.date):
def __init__(self, year):
datetime.date.__init__(self, year, 1, 1)
>>> D(2008)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: function takes exactly 3 arguments (1 given)
I wanted to c...
I have to convert some of my VB6 Code to C# , In my VB6 I am having code like
dim I as Long
I = Weekday(Now, vbFriday)
I want equivalent of the same in C#
Can any one Help ?
...
I have lots of home directories under /ifshome on Linux. I want to see which users have not logged in for the past 6 months, and my solution is to parse the /ifshome/user/.lastlogin file. Each .lastlogin file has the same format, 1 line:
Last Login: Fri Mar 09 18:06:27 PST 2001
I need to build a shell script that can parse the .lastlo...
How can I achieve the following with a format string: Do 01.01.2009 ?
It has to work in all languages (the example would be for Germany). So there should only be the short weekday and then the short date.
I tried 'ddd d' (without the '). However, this leads to 'Do 01'.
Is there maybe a character I can put before the 'd' so that it is tr...
I have a DateTime class and wish to display it according to some format... in this case, I specifically want to format it as YYYYMMDD format.
What's the best C#/.NET API function for doing this?
...
What would you recommend using between a datetime and a timestamp field, and why? (using mysql). I'm working with php on the server side.
...
I'd like a way to show natural times for dated items in Python. Similar to how Twitter will show a message from "a moment ago", "a few minutes ago", "two hours ago", "three days ago", etc.
Django 1.0 has a "humanize" method in django.contrib. I'm not using the Django framework, and even if I were, it's more limited than what I'd like.
...
I've used the localtime function in Perl to get the current date and time but need to parse in existing dates. I have a GMT date in the following format: "20090103 12:00" I'd like to parse it into a date object I can work with and then convert the GMT time/date into my current time zone which is currently Eastern Standard Time. So I'd li...
I want to limit a report to return records from Date A through Date B. This is what I have been doing:
declare @startDate varchar(20)
declare @endDate varchar(20)
set @startDate = '01/01/2008'
set @endDate = '04/01/2008'
-- test what are the start and end dates
select min(date),max(date) from view_Inspections
where date between @startD...
So I've finally got my WCF service setup and talking to browser via ASP.NET AJAX. But I have found that when I populate a html table with my data... the datetime format looks like this:
Fri Jan 02 2009 15:27:12 GMT-0500 (Eastern Standard Time)
On the server I am using the .NET DateTime format. Should I use something else and do the wor...
SQLAlchemy's DateTime type allows for a timezone=True argument to save a non-naive datetime object to the datbase, and to return it as such. Is there any way to modify the timezone of the tzinfo that SQLAlchemy passes in so it could be, for instance, UTC? I realize that I could just use default=datetime.datetime.utcnow; however, this is ...
I'm writing my first PHP app that has to directly deal with dates, and thus to directly deal with the fact that PHP and MySQL have different date formats.
My question is: what's the most elegant way to manage this difference?
I have the following two functions to manage the difference using php:
function mysql_date($php_date) {
r...
Can anyone find a constant in the .NET framework that defines the number of days in a week (7)?
DateTime.DaysInAWeek // Something like this???
Of course I can define my own, but I'd rather not if it's somewhere in there already.
Update:
I am looking for this because I need to allow the user to select a week (by date, rather than wee...
I have an SSIS data flow conditional split transformation that is returning a >= result when it should be returning a > result.
From the beginning... My SSIS package executes a SQL task that stores a max(date) from one table in variable User::max_date of type DateTime that has package scope.
My package then proceeds to execute a Data...
The data that I am sending to convertStringToDataSet function is
<NewDataSet>\r\n <Table ID="Table1">
\r\n
<PATNAME>Doe,JaneN</PATNAME>\r\n
<LEVEL>175</LEVEL>\r\n
<WHEN>2007-09-13T23:00:00.0000000-05:00</WHEN>\r\n
<NOTE>New 180-day low -- ALERT: loss of 11.6 % in 123 days</NOTE>\r\n
<IS_BAD>3...
double TotalMinute=300.0
double TotalMinutesAdded=1378.0
double TotalMinute=300.0
double TotalMinutesAdded=1378.0
foreach(DataRow dr in ds.Tables[0].Rows)
{
//Add The above Timings to each Row's 2nd Column
DateTime correctDate=Convert.ToDateTime(dr[2]);
correctDate.AddMinutes(TotalMinute);
corr...
I'm trying to call a stored procedure (on a SQL 2005 server) from C#, .NET 2.0 using DateTime as a value to a SqlParameter. The SQL type in the stored procedure is 'datetime'.
Executing the sproc from SQL Management Studio works fine. But everytime I call it from C# I get an error about the date format.
When I run SQL Profiler to w...
I have several servers hosted with GoGrid, and every time I reboot one of my cloud servers, the system clock is incorrect. The server isn't a member of a domain, so I just have the OS set to sync with an Internet time server. This only happens once a day, and I don't see an option to make this happen automatically upon reboot. So I'm lef...
Can someone plz tell me what's the Use of DataSet.Locale and can it be used to solve this issue.
My Server is located in US and I am running a query against it. The Data contained in the table both at Remote Server(U.S) and Local are same.
The Problem is when I am retrieving the DataSet using WebService from Remote Server. The Dates Co...