Questions tagged [datetime-generation]
26 questions
41
votes
7 answers
Entity Framework/SQL2008 - How to Automatically Update LastModified fields for Entities?
If i have the following entity:
public class PocoWithDates
{
public string PocoName { get; set; }
public DateTime CreatedOn { get; set; }
public DateTime LastModified { get; set; }
}
Which corresponds to a SQL Server 2008 table with the…

RPM1984
- 72,246
- 58
- 225
- 350
19
votes
5 answers
MySQL GROUP BY DateTime +/- 3 seconds
Suppose I have a table with 3 columns:
id (PK, int)
timestamp (datetime)
title (text)
I have the following records:
1, 2010-01-01 15:00:00, Some Title
2, 2010-01-01 15:00:02, Some Title
3, 2010-01-02 15:00:00, Some Title
I need to do a GROUP BY…

Brad
- 159,648
- 54
- 349
- 530
12
votes
1 answer
How to generate a virtual table to generate a sequence of dates in PostgreSQL?
I'd like to generate a list of dates with the hopes of joining with another table, but I don't know what syntax to use, something similar to this:
SELECT dates.date, transactions.account_id, transactions.amount
FROM (...) as dates
LEFT JOIN…

François Beausoleil
- 16,265
- 11
- 67
- 90
4
votes
1 answer
MySql Query: include days that have COUNT(id) == 0 but only in the last 30 days
I am doing a query to get the number of builds per day from our database for the last 30 days. But it has become needed to marked days where there were no builds also.
In my WHERE clause I use submittime to determine whether there were builds, how…

Hunter McMillen
- 59,865
- 24
- 119
- 170
4
votes
2 answers
MySQL Count data for last 7 days
I have the following schema.
Table votes
+------------------+--------------+------+-----+---------------------+----------------+
| Field | Type | Null | Key | Default | Extra …

GeekTantra
- 11,580
- 6
- 41
- 55
4
votes
1 answer
Grouping by date, return row even if no records found
I have a query that groups all entries from a table and groups them by the datetime column. This is all working great:
SELECT SUM( `value` ) AS `sum` , DATE(`datetime`) AS `dt``
FROM `entry`
WHERE entryid = 85
AND DATETIME BETWEEN '2010-01-01'…

Ian McIntyre Silber
- 5,553
- 13
- 53
- 76
3
votes
2 answers
Get data between last three years,
I'm try to load data between lasst three years. i want to get data between current datetime and last 3 years back.
eg:-FROM 1/19/2009 TO current time (1/19/2012)
I get the current time as below.
String date= DateFormat.getDateInstance().format(new…

TRS
- 490
- 2
- 11
- 29
3
votes
4 answers
selecting between date range and forcing empty rows to be 0?
I have a table that looks like
expires | value
-------------------
2011-06-15 | 15
2011-06-15 | 15
2011-06-25 | 15
2011-07-15 | 15
2011-07-15 | 15
2011-07-25 | 15
2011-08-15 | 15
2011-08-15 | 15
2011-08-25 | 15
I want to run a…

Hailwood
- 89,623
- 107
- 270
- 423
3
votes
4 answers
How Can I get days of an specific Week in PHP?
Possible Duplicate:
Calculating days of week given a week number
In PHP you can get the number of week with 'date('W');' and it will return ISO-8601 week number of year
Now how I can get the days of an specific week and the month(s)…
user529649
3
votes
3 answers
MySQL COUNT - return zero result, not NULL
I am trying to return a resultset from MySql which is grouped by the YEAR and MONTH, and which has a count returned for every YEAR/MONTH..
Here is where I started:
SELECT YEAR(p.pEndDate) AS pYear, MONTHNAME(p.pEndDate) AS pMonth, count(*) AS pNum…

Steve
- 340
- 4
- 16
3
votes
1 answer
Get sum of fields
Possible Duplicate:
MySQL Count data for last 7 days
I have an issue where i need to show the sum of fields. Lets say I have a recordset as follows,
detectDate |isp |infection | count
--------------------------------------
2012-10-02…

Hasitha Shan
- 2,900
- 6
- 42
- 83
2
votes
2 answers
Need to calculate date based on year - week - day
How can I calculate the date in C# when I recieve the year, weeknumber and day in week. For example:
Year = 2011
Week = 27
day = 6
result should be 2011-7-10
Thanks to all. I solved it based on the wikipedia algorithm.

user840828
- 21
- 1
2
votes
1 answer
select data with mysql
for instance if I have a table like this
total date
10 2010-01-01
15 2010-01-02
98 2010-01-03
50 2010-01-05
how can I write select statement to get output like this?
total date
10 2010-01-01
15 2010-01-02
98 …

qwera
- 185
- 1
- 1
- 11
1
vote
1 answer
Time and Date display
How do I display a Date and Time without java or a Picker, Like as simple as TimeView
android:@+id/ETC
android:TextSize="" and so on.
and I'll get the time or date from the device. Time/Date pickers take up to much display room.

len372
- 11
- 2
1
vote
1 answer
How to set cookie expiration date in asp.net
Good Day to All,
I am working with a small code, where I cant get my right hand part correctly
Response.Cookie("MyCookie").Expires=DateTime.FromString("2011-10-1");
Above cookie codes were used in my company's old project, I am updating the code…

nandu.com
- 343
- 1
- 5
- 18