date

mysql : Recieve data only per months

Hello, few times ago, i asked how to do to display datas per month, i must told a bad explanation because i just figured out that it's not what i want : Here's what I got : $req1 = ... AND v.date > (DATE_SUB(CURDATE(), INTERVAL 2 MONTH)) AND v.date < (DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) $req2= ... AND v.date > (DATE_SUB(CURDATE()...

Set the current date in PHP

I'm currently working on my company's in-house CMS and wish to add the ability for an admin to view the site on a specific date. This will allow admins to preview the site with archived or scheduled posts. I'd like to avoid finding all mentions of date() or time() and offsetting them. Is there a way of making PHP think it's a specific d...

HQL make query searching by date (Java+NetBeans)

Hi all I have the following issue. I have a table of reserves in my MySQL DB, the date columns is defined DATETIME. I need to make a query using hibernate to find all reserves in one day no matter the hour, just that its the same year month and date, and I'm doing this public List<Reserve> bringAllResByDate(Date date){ em = emf.createE...

converting time from hh:mm:ss to hh:mm in java

hi every one, I want to force the print screen of time like => hh:mm it comes from database (my sql) like hh:mm:ss. I tryed the following but i didn't got want i want. try { s= HibernateUtil.currentSession(); tx=s.beginTransaction(); Query query = s.createQuery("select from Dailytimesheet dailytimesheet where d...

date / time convert to time since php

Hello in my database date / time are in this format 2010-06-01T18:20:25+0000 I'd like to echo that out to time passed since that date / time e.g. 4 days 3 hours 36 minutes and 4 seconds is this possible? ...

php date() vs mysql MONTH()

Hi, i have this unix timestamp value: 1275364800 (1st june 2010). When printing that value with php: echo date('m',1275364800) it returns 6 (thats ok) But when i select a field from a database: select MONTH(FROM_UNIXTIME(1275364800)) AS month it returns 5 Why? BTW, if i run this query select FROM_UNIXTIME(1275364800) AS q i get 2010-...

Getting simple date and time in android

How can I easily get date and time as integer values in Android? ...

how to check string is valid date or not in rails

Hi All, i have a string say "31-02-2010" now i want to check that wheather this date is valid date or not . what is the best way to do it? so i need a method which i operate on string which returns true if date is valid and false if it's invalid. ...

Calculating the number of Saturdays and Sundays

How can I calculate the number of Saturdays and Sundays between two dates in php? Is there any inbuilt function for that purpose? ...

How can I format a Date in JavaME on a celphone application?

Here's my code: Date aux = new Date(); TextField txtFecha = new TextField("Fecha:", aux.toString(dd/mon/yyyy), 50, TextField.ANY); I'm trying to get my date to format like: "20/4/2010" Thank you! ...

Set date format in ruby model (sinatra/datamapper)

Hi, I have a ruby model that contains a date attribue which I'd like to be able to pass in as a parameter in the format dd/MM/yyyy. However, my sqlite3 db stores the data in yyyy-MM-dd format so when a date like 20/10/2010 gets passed in, it will not be read to the database. I am using the Sinatra framework and using haml for the mark...

compare string to date on mysql

In MySQL 4.0.21-standard, I have a table with a date, saved as a string. I want to compare this string with a date in my request. SELECT FE_CLIENT.* FROM FE_CLIENT WHERE D_DATFINPUBLI < '2010/06/03' How can I cast my column date_deb to a date for compare? ...

PHP create date object from yyyy-mm-ddThh:mm:ss string

I have a string in the format yyyy-mm-ddThh:mm:ss and I want to convert it to a date object. How would I do this? ...

YUI datatable and date displaying with Firefox

Hi, I am using a datatable loaded via JSON with date like this : 2010-06-03 With Opera and Chrome I have the correct date displayed as 06/03/2010. With Firefox Windows (even in safe mode, without any plug-in), I get a NaN/NaN/NaN. If I use the debug console, I see a valid date, but in Firefox Windows I can see a "Invalid date". Bonus, ...

How to get strptime to raise ArgumentError with garbage trailing characters

We have to handle user specified date formats in our application. We decided to go with Date.strptime for parsing and validation, which works great, except for how it just ignores any garbage data entered. Here is an irb session demonstrating the issue ree-1.8.7-2010.01 > require 'date' => true ree-1.8.7-2010.01 > d = Date.strptime '2...

Compare a DateTime to the current date

Hi I am trying to use a condition on events when the start_at DateTime is equal to or greater than Today's date. I want to list upcoming events, but clearly they are not upcoming if they have already passed. I have: @appointments = Event.find(:all, :conditions => ['move_id = ? AND start_at = ?', @move.id, Date.today]) I think I may...

How to deal with "partial" dates (2010-00-00) from MySQL in Django?

In one of my Django projects that use MySQL as the database, I need to have a date fields that accept also "partial" dates like only year (YYYY) and year and month (YYYY-MM) plus normal date (YYYY-MM-DD). The date field in MySQL can deal with that by accepting 00 for the month and the day. So 2010-00-00 is valid in MySQL and it represen...

What is wrong with this sql where-clause?

I am selecting records based on two dates in a same column but my where condition fails to select records on the StartDate and EndDate... where CreatedDate between @StartDate and @EndDate I get only the records inbetween the dates and not the records on the StartDate and EndDate... Consider if I pass the same date as StartDate and EndD...

Returning date from Stored procedure in ASP.Net/VB.Net

Hi, I want to execute a method on VB.Net to return a date which is in the stored procedure. I tried using ExecuteScalar but it doesnt work it retruns error 'Implicit conversion from data type datetime to int is not allowed. Use the CONVERT function to run this query' Any help would be much appreciated please? thank you below is the...

jquery/javascript convert date string to date

I have a date string "Sunday, February 28, 2010" that I would like to convert to a js date object formatted @ MM/DD/YYYY but don't know how. Any suggestions? ...