I have two tables where I was querying on a date column in each table.
In one case need to use the trunc() function on the date field to get values back, on the other I do not.
That is this works on table 1:
SELECT to_char( datecol1 ,'mm/dd/yyyy hh:mm:ss')
FROM table1 where datecol1 =to_date('10/07/2010', 'mm/dd/yyyy');
But o...
So, I have a table with column "ABC" is the timestamp, "BCD" is datetime.
If I do this:
SELECT * FROM myTable WHERE ABC > BCD
is it bad? and will it affect performance?
also, what is the performance between timestamp and datetime?
...
I need to compare a MySQL datetime with the current time, to get the dateDiff to show a messange if the MySQL datetime, is less than 30 days from today.
I'm using codeigniter, and I tried a lot of helpers, and lots of thing, I just can't get to work.
Some people says that is better to save in database a timespan, I just don't know wich...
I have this script:
var a="Thu Oct 07 16:50:0 CEST 2010";
var b=a.split("CEST");
var d = new Date(b[0]);
alert(d);
But it doesn't work how I want. In fact the date result differs from the original in the string.
The input is Thu Oct 07 16:50:0 CEST 2010 but the result is different Sat Oct 07 2000 16:50:00 GMT+0200 (CEST).
...
I want to get the absolute days away a datetime is from today. For example, i would like to know if a date is 2 days away, or 78 days away, or even 5,239 days away (not likely, but you get the idea). I am using an MS SQL database which is returning datetimes where the time components are all 00:00:00.
date_diff returns relative values...
While refactoring, I am looking for an optimised algorithm for a timetable (calendar) in PHP.
I have a list of events which have a list of timestamps. This must be presented in a tabular way. The current code works, but has a) quite some quircks and is b) very inflexible. I am looking to refactor this piece and looking for input on opti...
When I call
NSDate *now = [[NSDate alloc] init];
in order to get the current date and time, I check it with:
NSLog(@"Date now: %@", now);
the date outputted is one hour in the past.
2010-10-08 12:04:38.227
MiniBf[1326:207] Now: 2010-10-08
11:04:38 GMT
Is my time zone set incorrectly somewhere perhaps?
Thanks!
Micha...
Is there any difference between using the Microsoft.VisualBasic.DateAndTime.Now compared to the System.DateTime.Now?
I seem to remember reading something that said the MS.VB namespace was for legacy use only, and was much slower than using the native .net classes.
...
I have the following snippet that I use to get the individual dates between two dates:
DateTime[] output = Enumerable.Range(0, 1 + endDate.Subtract(startDate).Days)
.Select(offset => startDate.AddDays(offset))
.ToArray();
However, the following section
endDate.Subtract(startDate).Days
does not have a .Months to return the ...
I have a database where old code likes to insert '0000-00-00' in Date and DateTime columns instead of a real date. So I have the following two questions:
Is there anything that I could do on the db level to block this? I know that I can set a column to be not-null, but that does not seem to be blocking these zero values.
What is the b...
In particular, is there any difference between these two lines in terms of their outcomes:
File.SetCreationTime("foo.txt", DateTime.UtcNow);
File.SetCreationTimeUtc("foo.txt", DateTime.UtcNow);
Perhaps File.SetCreationTimeUtc("foo.txt", DateTime.Now) is just another way of doing File.SetCreationTime("foo.txt", DateTime.UtcNow)?
The s...
Hello,
I saved a datetime.datetime.now() as a string.
Now I have a string value, i.e.
2010-10-08 14:26:01.220000
How can I convert this string to
Oct 8th 2010
?
Thanks
...
Hi,
This one is a question I have asked myself several times, when creating Databases for PHP/MySQL web application.
In Mysql, what'd you recommend between Datetime and Timestamp and why?.
...
Hi all,
I am having a problem when converting irregular time series to regular time series. Below a simplified example can be found:
require(zoo)
t <- as.character(c(1981,1984,1985))
d <- c(1,3,6)
dt <- data.frame(d,t)
t <- as.Date(t,"%Y")
z <- zoo(d,t)
plot(z)
ts.d <- as.ts(as.zooreg(z,freq=1)) # create a regular ts object
ts.d # regu...
The scenario is as follows: given a totally arbitrary starting date in UTC there is an event that repeats every 24 hours. I need to calculate, given the current local time, how much time is left before the next event.
Ideally an ideal function would do:
time_since_start = now - start_time
remaining_seconds = time_remaining(time_since_s...
Hi
I'm writing a C# class that will convert strings to dates. Pretty easy I guess. The class accepts formatstrings like "yyyy-MM-dd" and inputstrings like "2010-10-10"
However I have some cases that give me trouble:
format "yyyyMMdd" input "19950000"
or
format "dd-MM-yyyy" input "00-06-2001"
Note that these cases have zeroes ('0...
I want to measure the execution of a piece of code and I'm wondering what the best method to do this is?
Option 1:
DateTime StartTime = DateTime.Now;
//Code
TimeSpan ts = DateTime.Now.Subtract(StartTime);
string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
ts.Hours, ts.Minutes, ts.Seconds,
ts.Millisecond...
Hi guys,
I want to query a database for records where the date is equal to, or greater than 90 days.
This is what I have so far:
$format = 'Y-m-j G:i:s';
$date = date ( $format );
// -90 days from today
date ( $format, strtotime ( '-90 day' . $date ) );
I'm just a bit unsure now how to structure the MYSQL query. Would it be s...
I am doing some large timestamp-list iterations: Putting them in tables with date-ranges, and grouping them by ranges.
In order to do that, I found strtotime() a very helpfull function, but I am worried about its performance.
For example, a function that loops over a list of weeks (say, week 49 to 05) and has to decide the beginning of...
I want to round current time to the nearest 15 minute interval.So if it is currently 6:07, it would read 6:15 as the start time.
How can I do that?
...