date

Set "Last-Modified" Header to "Date-Modified" of File in ASP.NET MVC ?

Hi Guys, I am trying to figure out in ASP.NET MVC how to optimize getting the "Date modified" to use in the last-modified header in ASP.NET MVC. I dont want to check the date of each request as this seems loss of performance. Basically, at the moment I am using "Release Date" for date-modified, but the problem here is that everytime ...

Check if the time is past 9pm using PHP

What I am trying to do is I have a selected date formatted as below: $selectedDate = 2010/02/24 I want to check it is both todays date and it is past 9pm on the server and set a value if it is. I can get a time by using the following: $checkTime = date("H:i"); I want to create something like: if ($checkTime > 21:00 && $selectedD...

Add number of days to a date

Hi, I want to add number of days to current date: I am using following code: $i=30; echo $date = strtotime(date("Y-m-d", strtotime($date)) . " +".$i."days"); But instead of getting proper date i am getting this: 2592000 Please help me on this Thanks, Pankaj ...

PHP date format converting

Here is what I have: $dateFormat = 'M d, Y'; $dateString = 'January 23, 2010'; What I need is a timestamp of $dateString so I can do this: $newFormattedDate = date('Y-m-d', $timestamp); I tried to use strtotime function but it tries to find out the format itself and doesn't work always. In my situation I know both the date string a...

Return dates of current calendar week as array in PHP5

How would I put together a PHP5 function that would find the current calendar week and return the dates of each day in the week as an array, starting on Monday? For example, if the function were run today (Thu Feb 25 2010), the function would return an array like: [0] => Mon Feb 22 2010 [1] => Tue Feb 23 2010 [2] => Wed Feb 24 2010 [3] ...

Adding dates in JavaScript in one line

Hi everyone, I'm trying to perform date manipulations using JavaScript on a single line, and I'm having problems with the year (not the month or day). I got the idea from this link. Am I missing something? The code is as follows: var newyear = new Date((new Date()).getYear(), (new Date()).getMonth(), (new Date()).getDate()+5).getFullYe...

C# - Calculate min date / max date from a List

I have a List which contains Dates : List<string> StringDates; [0]: "04.03.2010" [1]: "09.03.2010" [2]: "11.03.2010" [3]: "12.03.2010" [4]: "16.03.2010" [5]: "18.03.2010" [6]: "19.03.2010" [7]: "23.03.2010" [8]: "25.03.2010" [9]: "26.03.2010" Using C# what is the best/shortest way to find out ...

generating dates of previous seven days in php

I need help regarding generating dates and days of the last seven to ten days with respect to today. How an accurate timestamp can be created which can take care of week, month and year change ? ...

how to change the date format from mm/dd/yyyy to dd-mm-yyyy in combobox?

i have a combobox which is displaying date from database...in my database the date enteries are in the format of mm/dd/yyyy but i want to display them in the format of dd-mm-yyyy...in that combobox..when the application run. ...

check if a date is older that the current time in Rails

Hello, I am doing a validations in my model to check if a date is older than today (meaning a date can only be in future from the current time) I was about to write down a block of code, but was wondering is there a build in function for this. The date is passed from a view using: <%= date_select ('load', :valid_until, :order => [:d...

drupal profile date format

I added some users from an excel via a script to my drupal database. This works fine except for one thing, i use the profile module to store some information, one of them is the date of birth. In my excel the date is stored like '18/02/1995' but in the database a date field has a format like this 'a:3:{s:5:"month";s:1:"2";s:3:"day";s:2:...

Java Date Hibernate cut off time

Hi folks, I have a Date type column in Oracle DB and it contains date and time for sure. But when I'm trying to get data in java application it will return date with bunch of zeros instead of real time. In code it'll be like: SQLQuery sqlQuery = session.createSQLQuery("SELECT table.id, table.date FROM table"); List<Object[]> resultArra...

Converting to date in PHP from yyyymmdd format

I have dates in the following format (yyyymmdd, 18751104, 19140722)... what's the easiest way to convert it to date().... or is using mktime() and substrings my best option...? ...

JavaScript date: How to add a year to a string that contains mm/dd?

Hola, I have an string that contains month/date and I need to insert the year. The string looks like: Last Mark:: 2/27 6:57 PM I want to convert the string to something like: Last Mark:: 2010/02/27 18:57 In this case, there will not be any entries more than a year old. For example, if the date were 10/12 it can be assumed that the...

PHP How to compare date and date?

I have this value from database: '2009-1-1 00:00:00', okay, let me paste my code: $fetch = mysql_fetch_assoc($result); $db_value = $fetch['date'];//'2009-1-1 00:00:00' $today = date('Y-m-d H:i:s'); // Todays date If I want to compare the two values, what should I do: if($db_value < $today){ // Do something } or method 2, conv...

compare the dates with linq

I have this code: i.SpesaVitto = db.TDP_NotaSpeseSezB.Where(p => p.GiornoFine == null && ((DateTime)p.Giorno).Date == ((DateTime)i.Data).Date && p.MissioneID == missioneID).Sum(p => p.Costo); If i launch it i obtain this error: The specified type member 'Date' is not supported in LINQ to Entities. ...

Flex, how to get week of year for a date?

Hi; I could not find a method in Flex Date object to get the week of year (1 to 52) What is the best way to find this? Is there any useful library for flex for such date operations like JodaTime in Java. ...

Why is this code displaying different dates?

import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class DateDemo { public static void main(String[] args) throws ParseException { SimpleDateFormat datef = new SimpleDateFormat("dd/mm/yyyy"); Date date1 = new Date(2010, 03, 03) ; Date date2 = datef.parse("03/0...

How to convert timestamps to dates in bash?

I need a shell command or script that converts a UNIX timestamp to a date. The input can come either from the first parameter or from stdin, allowing for the following usage patterns: ts2date 1267619929 and echo 1267619929 | ts2date Both commands should output "Wed Mar 3 13:38:49 2010". ...

JSF Convert dates for title attribute

I need to put a date into the title attribute of an image so that it displays when the user puts the mouse over. Problem is I would like to change the date format. Any ideas? <ice:graphicImage value="bean.image" title="#{bean.date}"/> ...