date

Using date to append filename to database backups made by cron

Hello, The title says it all. I want to maintain multiple dated backups via cron but I can't seem to figure out how to concatenate the file name in cron. Currently I just use the following: /bin/mv /var/www/vhosts/mysite.org/dbBackups/today.sql /var/www/vhosts/mysite.org/dbBackups/yesterday.sql /usr/bin/mysqldump --add-drop-table -...

CakePHP Model with "Between dates"

I have a large data set (over a billion rows). The data is partitioned in the database by date. As such, my query tool MUST specify an SQL between clause on every query, or it will have to scan every partition.. and well, it'll timeout before it ever comes back. So.. my question is, the field in the database thats partitioned is a dat...

MySql get rows between date values

I'm doing the following query and getting all rows returned, regardless of date: SELECT DISTINCT p.name, p.category, u.f_name, t.name FROM ( prizes p, tags t, results r ) LEFT JOIN users u ON (r.user_id = u.id) LEFT JOIN f_tag_lookup tl ON (tl.tag_id = t.id) WHERE r.tag_id = t.id ...

Prevent java from localizing SimpleDateFormat output

Basicaly I want to format a Date object using a specific pattern and the output should be in English. How can I prevent java from translating the output in the system language? String date = new SimpleDateFormat("EEE MMM dd kk:mm:ss yyyy").format(myDate); // output is in German: // Mi Aug 26 16:35:55 2009 ...

How can I print a locale aware date using Zend_Date?

I'd like to use Zend_Date to print out the previous 2 months and year as a string e.g.: July 2009 June 2009 I need it to be locale aware so that if the code runs with the locale set to, say, German, the month names will print in German. $date = new Zend_Date(); $date->subMonth(1); echo $date->get(Zend_date::MONTH_NAME).' '.$...

Incorrect result for date comparison (to a timestamp column) in mysql

I've been having some 'strange' results while comparing dates. table1 has two rows with TIMESTAMPS values 2009-08-26 23:39:56 and 2009-08-27 00:01:42 When I make this query: select * from table1 c INNER JOIN table2 r ON r.table1_id = c.id WHERE DATE(c.authorization_date) = '2009-08-26' it returns both rows (when it only should have re...

Java Date Format for Locale

How can I find the DateFormat for a given Locale? ...

Just Date or Time

I'm just wondering .. I have and object like this public class Entry{ public DateTime? Date { get; set;} // This is just Date public DateTime? StartTime { get; set; } //This is just Time public TimeSpan Duration { get; set; } //Time spent on entry } Is there a more appropriate type than DateTime or better strategy to handling j...

Convert Sqlite BigInt to Date

I have a Sqlite database that I am using as an ado.net job store for my Quartz.net scheduler jobs. In one table, a column called START_TIME is of type big int. Is there a way to cast or convert a bigint to a date value? I would like to be able to query the database to see which jobs are scheduled at what date/time and a value such as...

Need to pull last x number of rows based on date.

I have a table with dates in "Aug 23, 2009" format and 5 values, so that it looks like this SELECT * FROM table; Date | Total | V1 | V2 | V3 | V4 Aug 21, 2009 | 41 | 23 | 8 | 8 | 2 Aug 22, 2009 | 39 | 22 | 8 | 7 | 2 Aug 23, 2009 | 35 | 20 | 6 | 7 | 2 Aug 24, 2009 | 34 | 20 | 6 | 6 | 2 Aug 25, 2009 | 32 ...

[NSDate description] -> NSDate

Hi, I store my NSDates to a file in the international format you get when you call description on a NSDate. However, I don't know how to go back: from the string-format to a NSDate object. NSDateFormatter seems to be limited to a couple of formats not including the international one. How should I go back from the string-format? Thank...

Does the formatting of a date depend on both the user's locale and calendar system?

I feel this question is very general for all programmers on all languages. This is somewhat blurry. First, there are locales, which encapsulate cultural information and other stuff. I believe these locale objects also encapsulate information about date and time formatting, i.e. how to display a date, in Unicode Standard. Like so, for exa...

Detecting an "invalid date" Date instance in JavaScript

I'd like to tell the difference between valid and invalid date objects in JS, but couldn't figure out how: var d = new Date("foo"); console.log(d.toString()); // shows 'Invalid Date' console.log(typeof d); // shows 'object' console.log(d instanceof Date); // shows 'true' Any ideas for writing an isValidDate function? EDIT - thanks fo...

How to get the year number with PHP?

2009 this year, 2010 next year. ...

why am I getting '4:00' when I'm trying to display time using the date function with php?

I am trying to display a time I have in my database. I managed to have it display a time in the correct format for what I need, but for some reason, it is only displaying '4:00' every time. Here is my code: date('g:i', strtotime($row['startTime'])) An example of I have the time displayed in my database is like this: 00:12:30 Why i...

C# Regular Expression to validate a date?

I am trying to validate a date entered into a text box. There is an input mask on the textbox which forces input of xx/xx/xxxx. I am trying to use a regular expression validator to enforce that a correct date is entered. I am not skilled in RegEx bascially at all. My co-worker found this one on the internet but I can't really tell what ...

Getting the Time component of a Java Date or Calendar

Is there a simple or elegant way to grab only the time of day (hours/minutes/seconds/milliseconds) part of a Java Date (or Calendar, it really doesn't matter to me)? I'm looking for a nice way to separately consider the date (year/month/day) and the time-of-day parts, but as far as I can tell, I'm stuck with accessing each field separat...

[HQL/Hibernate] Error: Cannot convert value '0000-00-00 00:00:00' from column 13 to TIMESTAMP

the field definition /** Date. */ @Column(columnDefinition = "datetime") private Date date; setter public void setDate(final Date date) { DateFormat dfmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); try { this.date = dfmt.parse(dfmt.format(date)); } catch (ParseException e) { // TODO Auto-generated catc...

add two or more time strings in php

Hi, I have an array with times (string) e.g "2:23", "3:2:22" etc. $times = array("2:33", "4:2:22", "3:22") //loner I want to find the total sum of all array. Is there a way that I could add times like "2:33" and "3:33" ("i:s") thanks ...

Exclude items who has a later date than the date of today

I have a question about XSLT. On a website i have a simple calendar, showing events who are going on in the future. But when an event is done, it should be removed from my list. By done i mean, that the date of the event is past the date of today. Every event have a date attached. Look at the folowing code: <xsl:for-each select="$cu...