Search Results

Search found 23226 results on 930 pages for 'date format'.

Page 11/930 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • How can I work out if a date is on or before today?

    - by Yvonne
    My web application consists of library type system where books have due dates. I have the current date displayed on my page, simply by using this: date_default_timezone_set('Europe/London'); $date = date; print $date("d/m/Y"); I have set 'date' as a variable because I'm not sure if it makes a difference when I use it in the IF statement you're about see, on my library books page. On this page, I am simply outputting the due dates of the books, many have dates which have not yet reached todays date, and others which have dates greater than todays date. Basically, all I want is the due date to appear bold (or strong), if it has passed todays date (the system displayed date). This is what I have and thought would work: <? if ($duedate < $date) { echo '<td><strong>'; } else { echo '<td>'; } ?> <?php echo $date('d/m/Y', $timestamp);?></strong></td> I have declared $timestamp as a var which converts the date of default MySQL format to a UK version. Can anyone help me out? I thought this would've been very straight forward!

    Read the article

  • JQuery and the multiple date selector

    - by David Carter
    Overview I recently needed to build a web page that would allow a user to capture some information and most importantly select multiple dates. This functionality was core to the application and hence had to be easy and quick to do. This is a public facing website so it had to be intuitive and very responsive. On the face of it it didn't seem too hard, I know enough juery to know what it is capable of and I was pretty sure that there would be some plugins that would help speed things along the way. I'm using ASP.Net MVC for this project as I really like the control that it gives you over the generated html and javascript. After years of Web Forms development it makes me feel like a web developer again and puts a smile on my face, that can only be a good thing!   The Calendar The first item that I needed on this page was a calender and I wanted the ability to: have the calendar be always visible select/deselect multiple dates at the same time bind to the select/deselect event so that I could update a seperate listing of the selected dates allow the user to move to another month and still have the calender remember any dates in the previous month I was hoping that there was a jQuery plugin that would meet my requirements and luckily there was! The jQuery datepicker does everything I want and there is quite a bit of documentation on how to use it. It makes use of a javascript date library date.js which I had not come across before but has a number of very useful date utilities that I have used elsewhere in the project. As you can see from the image there still needs to be some styling done! But there will be plenty of time for that later. The calendar clearly shows which dates the user has selected in red and i also make use of an unordered list to show the the selected dates so the user can always clearly see what has been selected even if they move to another month on the calendar. The javascript code that is responsible for listening to events on the calendar and synchronising the list look as follows: <script type="text/javascript">     $(function () {         $('.datepicker').datePicker({ inline: true, selectMultiple: true })         .bind(             'dateSelected',             function (e, selectedDate, $td, state) {                                 var dateInMillisecs = selectedDate.valueOf();                 if (state) { //adding a date                     var newDate = new Date(selectedDate);                     //insert the new item into the correct place in the list                     var listitems = $('#dateList').children('li').get();                     var liToAdd = "<li id='" + dateInMillisecs + "' >" + newDate.toString('ddd dd MMM yyyy') + "</li>";                     var targetIndex = -1;                     for (var i = 0; i < listitems.length; i++) {                         if (dateInMillisecs <= listitems[i].id) {                             targetIndex = i;                             break;                         }                     }                     if (targetIndex < 0) {                         $('#dateList').append(liToAdd);                     }                     else {                         $($('#dateList').children("li")[targetIndex]).before(liToAdd);                     }                 }                 else {//removing a date                     $('ul #' + dateInMillisecs).remove();                 }             }         )     }); When a date is selected on the calendar a function is called with a number of parameters passed to it. The ones I am particularly interested in are selectedDate and state. State tells me whether the user has selected or deselected the date passed in the selectedDate parameter. The <ul> that I am using to show the date has an id of dateList and this is what I will be adding and removing <li> items from. To make things a little more logical for the user I decided that the date should be sorted in chronological order, this means that each time a new date is selected it need to be placed in the correct position in the list. One way to do this would be just to append a new <li> to the list and then sort the whole list. However the approach I took was to get an array of all the items in the list var listitems = ('#dateList').children('li').get(); and then check the value of each item in the array against my new date and as soon as I found the case where the new date was less than the current item remember that position in the list as this is where I would insert it later. To make this work easily I decided to store a numeric representation of each date in the list in the id attribute of each <li> element. Fortunately javascript natively stores dates as the number of milliseconds since 1 Jan 1970. var dateInMillisecs = selectedDate.valueOf(); Please note that this is the value of the date in UTC! I always like to store dates in UTC as I learnt a long time ago that it saves a lot of refactoring at a later date... When I convert the dates back to their original back on the server I will need the UTC offset that was used when calculating the dates, this and how to actually serialise the dates and get them posted back will be the subject of another post.

    Read the article

  • Date format broken in .net 4.0 for uk format

    - by Chris Foot
    I'm in the process of converting a couple of sites up to .net 4.0 and I seem to have a problem with regionalisaion of dates. This code: Date.Today.AddDays((Date.Today.DayOfWeek - 1) * -1).ToString() In .net 3.5 produces: '19/04/2010 00:00:00' but as soon as I change the app pool to 4.0 it produces: '4/19/2010 12:00:00 AM' Where can I change the setting that governs this?

    Read the article

  • Calculating a delta of years from a date

    - by Spiros
    I am trying to figure out a way to calculate the year of birth for records when given the age to two decimals at a given date - in Perl. To illustrate this example consider these two records: date, age at date 25 Nov 2005, 74.23 21 Jan 2007, 75.38 What I want to do is get the year of birth based on those records - it should be, in theory, consistent. The problem is that when I try to derive it by calculating the difference between the year in the date field minus the age, I run into rounding errors making the results look wrong while they are in fact correct. I have tried using some "clever" combination of int() or sprintf() to round things up but to not avail. I have looked at Date::Calc but cant see something I can use. p.s. As many dates are pre-1970, I cannot not unfortunately use UNIX epoch for this.

    Read the article

  • Perl: calculating a delta of years from a date

    - by Spiros
    Hello, I am trying to figure out a way to calculate the year of birth for records when given the age to two decimals at a given date - in Perl. To illustrate this example consider these two records: date, age at date 25 Nov 2005, 74.23 21 Jan 2007, 75.38 What I want to do is get the year of birth based on those records - it should be, in theory, consistent. The problem is that when I try to derive it by calculating the difference between the year in the date field minus the age, I run into rounding errors making the results look wrong while they are in fact correct. I have tried using some "clever" combination of int() or sprintf() to round things up but to not avail. I have looked at Date::Calc but cant see something I can use. p.s. As many dates are pre-1970, I cannot not unfortunately use UNIX epoch for this.

    Read the article

  • Rails - Trying to query from a date range...everything from today

    - by ChrisWesAllen
    I'm trying to figure the best way to query a date range from rails...I looked around on Google but am unsure about how to use this syntax. I have a Model that has various events and I like to add to my find condition a caveat that should only show events where the field :st_date is today or later, in effect only show me data that is current, nothing that happened before today. I ran into a problem because I have no end date to stop the query, I want to query everything from today to next month. I was thinking something like @events = Event.find(:all, :conditions => ["start_date between ? and ?", date.Today, date.next_month.beginning_of_month]) but I get the error undefined local variable or method `date'...... Do I need do anything particular to use the Date class? Or is there something wrong with my query syntax? I would really appreciate any help.

    Read the article

  • Convert date from access to SQL Server with SSIS

    - by Arne
    Hi, I want to convert a database from access to SQL Server using SSIS. I cannot convert the date/time columns of the access db. SSIS says something like: conversion between DT_Date and DT_DBTIMESTAMP is not supported. (Its translated from my German version, might be different in English version). In Access I have Date/Time column, in SQL Server I have datetime. In the dataflow chart of the SSIS I have a OLE DB source for the access db, an sql server target and a data conversion. In the data conversion I convert the columns to date[DT_DATE]. They are connected like this: AccessDB -> conversion -> SQL DB What am I doing wrong? How can I convert the Access date columns to SQL Server date columns?

    Read the article

  • Significance of date 02/31/2157?

    - by dpatchery
    I work in a large scale IT support environment. Twice now we have seen an invalid date of 02/31/2157 being inserted in an Oracle DATE column. So far I have not been able to reproduce this problem, but it appears to be happening occasionally when a user attempts to save '00/00/0000' into the column. I believe the value is originating from a PowerBuilder DataWindow update. The application uses myriad libraries for all sorts of technologies, so this question may be a bit vague, but... Has anyone seen the date 02/31/2157 in some established library that Oracle could be defaulting to when some other invalid date is entered? Perhaps an end-of-time concept analogous to the beginning-of-time date of 1/1/1970?

    Read the article

  • How to convert "9:00 PM EST" to a Date object

    - by Bara
    I am developing an Android application and require some basic datetime manipulation. I have a Date object (from Java.util.Date) holding a specific date. I need to add a specific time to it. The time I have is a string in this format: "9:00 PM EST" How would I "add" this time to the previous date? If the Date object currently has: "4/24/10 00:00:00" How would I change it to instead be: "4/24/10 09:00:00 EST" I would prefer to do this without the use of an external library, if possible.

    Read the article

  • How do I get the current date according to an NTP server without setting it locally?

    - by Zac B
    I want to get the current date and time according to a remote NTP server, using Linux. I don't want to change the local time as a result; I just want to get the remote date, adjusted for the local time zone, printed out. The date returned must comply with the following criteria: It needs to be reasonably accurate. It needs to be adjusted for the timezone on the local system making the request. It needs to be formatted in an easily-readable or interpretable way (standard date format, or seconds since epoch). What I've Tried: I can call ntpdate -q my.ntp.server and get the offset between the local time and the server's time, but that doesn't return the date according to the NTP server; it just returns the offset and the local date. Is there some easy way/command I can use to say: "Print out the date according to a given NTP server, adjusted for my current timezone"?

    Read the article

  • Compare two date whit jquery

    - by Mercer
    Hello, i have two String fields who represent Date in my page and i would to compare this two fields to know if my first date < second date <tr> <td align="right">First Date: </td> <td align="left"> <html:text name="addPublicationForm" styleId="firstDate" property="firstDate" maxlength="10"/></td> </tr> <tr> <td align="right">Second Date: </td> <td align="left"> <html:text name="addPublicationForm" styleId="secondDate" property="secondDate" maxlength="10"/></td>

    Read the article

  • Search for files after a relative date using Windows search

    - by Zoredache
    I am looking for a way to save a search that includes a relative date. Specifically I am looking for a way to save a search that matches files that have a modification date that is 7 days ago. I have read the Windows Search Advanced Query Syntax document and I am not seeing a way to say 7 days ago. The numbers and ranges section does mention that relative dates are possible. The problem is that the relative dates described there do not fit the criteria I need. The lastweek almost looks like what I want except if I run a query like after:lastweek on a Monday it will only show my file that have been modified since Sunday at 12:00. The lastweek/lastmonth seem to relative to the start of the week/month which is not what I need. Multi-word relative dates: week, next month, last week, past month, or coming year. The values can also be entered contracted, as follows: thisweek, nextmonth, lastweek, pastmonth, comingyear. One nice thing about saved searches is that they are stored as an XML document and the file format is documented. I am not seeing how to form a correct value for a datetime. If I was able to understand this format, I suspect I could use a text editor and created a saved search that does what I want. Fragment from the examples: <conditions> <condition type="leafCondition" valuetype="System.StructuredQueryType.DateTime" property="System.DateModified" operator="imp" value="R00UUUUUUUUZZXD-30NU" propertyType="wstr" /> </conditions> To summarize I am looking for an answer to one or both of these questions How do I make a query for '7 days ago' using the standard syntax? How is the DateTime stored in a saved search?

    Read the article

  • Date query with Hibernate on Timestamp Column in PostgreSQL

    - by Shashikant Kore
    A table has timestamp column. A sample value in that could be 2010-03-30 13:42:42. With Hibernate, I am doing a range query Restrictions.between("column-name", fromDate, toDate). The Hibernate mapping for this column is as follows. <property name="orderTimestamp" column="order_timestamp" type="java.util.Date" /> Let's say, I want to find out all the records that have the date 30th March 2010 and 31st March 2010. A range query on this field is done as follows. Date fromDate = new SimpleDateFormat("yyyy-MM-dd").parse("2010-03-30"); Date toDate = new SimpleDateFormat("yyyy-MM-dd").parse("2008-03-31"); Expression.between("orderTimestamp", fromDate, toDate); This doesn't work. The query is converted to respective timestamps as "2010-03-30 00:00:00" and "2010-03-31 00:00:00". So, all the records for the 31st March 2010 are ignored. A simple solution to this problem could be to have the end date as "2010-03-31 23:59:59." But, I would like to know if there is way to match only the date part of the timestamp column. Also, is Expression.between() inclusive of both limits? Documentation doesn't throw any light on this.

    Read the article

  • How do I improve this design for dealing with intersecting date ranges and resolving date range conf

    - by derdo
    I am working on some code that deals with date ranges. I have pricing activities that have a starting-date and an end-date to set a certain price for that range. There are multiple pricing activities with intersecting date ranges. What I ultimately need is the ability to query valid prices for a date range. I pass in (jan1,jan31) and I get back a list that says jan1--jan10 $4 , jan11--jan19 $3 jan20--jan31 $4. There are priorities between pricing activities. Some type of pricing activities have high priority, so they override other pricing activities and for certain type of pricing activities lowest price wins etc. I currently have a class that holds these pricing activities and keeps a resolved pricing calendar. As I add new pricing activities I update the resolved calendar. As I write more tests/code, it started to get very complicated with all the different cases (pricing activities intersecting in different ways). I am ending up with very complicated code where I am resolving a newly added pricing activity. See AddPricingActivity() method below. Can anybody think of a simpler way to deal with this? Could there be similar code somewhere out there? Public class PricingActivity() { DateTime startDate; DateTime endDate; Double price; Public bool StartsBeforeEndsAfter (PricingActivity pAct) { // pAct covers this pricing activity } Public bool StartsMiddleEndsAfter (PricingActivity pAct){ // early part of pAct Itersects with later part of this pricing activity } //more similar methods to cover all the combinations of intersecting } Public Class PricingActivityList() { List<PricingActivity> activities; SortedDictionary<Date, PricingActivity> resolvedPricingCalendar; Public void AddPricingActivity(PricingActivity pAct) { //update the resolvedCalendar //go over each activity and find intersecting ones //update the resolved calendar correctly //depending on the type of the intersection //this part is getting out of hand….. } }

    Read the article

  • How to set a static system date for one user or application--"Groundhog Day"

    - by aixylinux
    I have a vendor application on AIX which requires the system date to be set to an arbitrary value for QA testing purposes. The application gets its date from the system, and there is no possibility of changing it to get the date from a parameter. The application runs under a specific userid. I'd like to find a way to set the date for this application or user to a private value without affecting all the other users and applications on the system. So far the only thing I have been able to do is dedicate an LPAR to this application. Every day at midnight a root crontab job resets the date to the static value. This works, but it is wasteful of resources; and now I am faced the requirement to do this for other applications, which, of course, require different dates. Is there any clever solution to this? I need a way to create a sandboxed environment where the date returned from the system can be set to a private value. As I said, the OS is AIX, and that can't be changed for this application either.

    Read the article

  • Warning: date() expects parameter 2 to be long, string given in

    - by Simon
    its the $birthDay = date("d", $alder); $birthYear = date("Y", $alder); i dont know what it is here is my code //Dag $maxDays = 31; $birthDay = date("d", $alder); echo '<select name="day">'; echo '<option value="">Dag</option>'; for($i=1; $i<=$maxDays; $i++) { echo '<option '; if($birthDay == $i){ echo 'selected="selected"'; } echo ' value="'.$i.'">'.$i.'</option>'; } echo '</select>'; //Måned echo '<select name="month">'; $birthMonth = date("m", $alder); $aManeder = 12; echo '<option value="">Måned</option>'; for($i = 1; $i <= $aManeder; $i++) { echo '<option '; if($birthMonth == $i) { echo 'selected="selected"'; } echo ' value="'.$i.'">'.$ManderArray[$i].'</option>'; } echo '</select>'; //År $startYear = date("Y"); $endYear = $startYear - 30; $birthYear = date("Y", $alder); echo '<select name="year">'; echo '<option value="">år</option>'; while($endYear <= $startYear) { echo '<option '; if($birthYear == $endYear) { echo 'selected="selected"'; } echo ' value="'.$endYear.'">'.$endYear.'</option>'; $endYear++; } echo '</select>';

    Read the article

  • recommended format to save time with MJD + BCD format in database

    - by pierr
    Hi, There is a time represented in MJD and BCD format with 5 bytes .I am wondering what is the recommended format to save this date-time in the sqlite database so that user can search against it ? My first attempt is to save it just as it is, that is a 5 bytes string. The user will use the same format to search and the result will be converted to unix time by the user with following code. However, later, I was suggested to save the time in the integer - the UTC time, for example. But I can not find a standard way to do the conversion. I feel this is a common issue and would like to hear your comments. time_t sidate_to_unixtime(unsigned char sidate[]) { int k = 0; struct tm tm; double mjd; /* check for the undefined value */ if ((sidate[0] == 0xff) && (sidate[1] == 0xff) && (sidate[2] == 0xff) && (sidate[3] == 0xff) && (sidate[4] == 0xff)) { return -1; } memset(&tm, 0, sizeof(tm)); mjd = (sidate[0] << 8) | sidate[1]; tm.tm_year = (int) ((mjd - 15078.2) / 365.25); tm.tm_mon = (int) (((mjd - 14956.1) - (int) (tm.tm_year * 365.25)) / 30.6001); tm.tm_mday = (int) mjd - 14956 - (int) (tm.tm_year * 365.25) - (int) (tm.tm_mon * 30.6001); if ((tm.tm_mon == 14) || (tm.tm_mon == 15)) k = 1; tm.tm_year += k; tm.tm_mon = tm.tm_mon - 2 - k * 12; tm.tm_sec = bcd_to_integer(sidate[4]); tm.tm_min = bcd_to_integer(sidate[3]); tm.tm_hour = bcd_to_integer(sidate[2]); return mktime(&tm); }

    Read the article

  • AWS free tier "sign up date" vs "credit card details submission date"

    - by Mayur Rokade
    I am worried about my account expiry date. I created an account on AWS in July 2013 and submitted my credit card details on 31st Oct 2013. I went in Billing Management Console/Bills section where when I click on Date, I can see months ranging from July 2013 to Nov 2013. From AWS FAQs I gathered When does the AWS free usage tier expire? The AWS free usage tier will expire 12 months from the date you sign up. So WHEN will my account expire, July 2014 (sign up date) or Oct 2014 (credit card details submission date) ?

    Read the article

  • Convert PHP date into javascript date format

    - by LeeTee
    I have a PHP script that outputs an array of data. This is then transformed into JSON using the json_encode() function. My issue is I have a date within my array and its is not in the correct javascript format. How can I convert this within PHP so it is? $newticket['ThreadID'] = $addticket; $newticket['Subject'] = $subject; //$newticket['DateCreated'] = date('d-m-Y G:H'); Instead of the above fo rthe date I need the equivilant of the javascript function new Date() When I output the above I get the following "Fri Jun 01 2012 11:08:48 GMT+0100 (GMT Daylight Time)" However, If I format my PHP date to be the same, javascript rejects it. Confused... Can anyone help?

    Read the article

  • Use of date function in PHP to output a user-friendly date

    - by Jamie
    I have a MySQL database column named DateAdded. I'd like to echo this as a readable date/time. Here is a simplified version of the code I currently have: $result = mysql_query(" SELECT ListItem, DateAdded FROM lists WHERE UserID = '" . $currentid . "' "); while($row = mysql_fetch_array($result)) { // Make the date look nicer $dateadded = date('d-m-Y',$row['DateAdded']); echo $row['ListItem'] . ","; echo $dateadded; echo "<br />"; } Is the use of the date function the best way to output a user-friendly date? Thanks for taking a look,

    Read the article

  • Convert Json date string to JavaScript date object

    - by dagda1
    Hi, I have the following JSON object which has a date field in the following format: { "AlertDate": "\/Date(1277334000000+0100)\/", "Progress": 1, "ReviewPeriod": 12 } I want to write a regular expression or a function to convert it to a javascript object so that it is in the form: { "AlertDate": "AlertDate":new Date(1277334000000), "Progress": 1, "ReviewPeriod": 12 } The above date format fails validation in the JQuery parseJSON method. I would like to convert the 1277334000000+0100 into the correct number of milliseconds to create the correct date when eval is called after validation. Can anyone help me out with a good approach to solving this? Cheers Paul

    Read the article

  • php add hours to date output wrong result

    - by i need help
    Basically what I want to do is to send an email to follow up on order placed in 3 hours later. What I try to do is to get the current date (up to hours level), then compare with the orderdate+ 3 hours, to see whether it match. Example orderdate: 2010-06-12 18, after add 3 hours should become 2010-06-12 21 However, after add hour, the final result sometimes become bigger, sometimes become smaller... something wrong. $now= date('Y-m-d H'); echo $now . "<br>"; ... ... while ($data = mysql_fetch_array ($result)) { $orderid = $data['orderid']; $orddate = $data['orddate']; $corddate= date('Y-m-d H:i:s', $orddate); $year = substr ($corddate, 0, 4); $month = substr ($corddate, 5, 2); $day = substr ($corddate, 8, 2); $hour = substr ($corddate, 11, 2); $actualorderdate= $year . "-" . $month . "-" . $day . " " . $hour; $new_time = mktime ($hour+3, 0, 0, $month, $day, $year); $year = date ('Y', $new_time); $month = date ('m', $new_time); $day= date ('d', $new_time); $hour= date ('h', $new_time); $xhourslater= $year . "-" . $month . "-" . $day . " " . $hour; echo "actualorderdate: ". $actualorderdate. " xhourslater: " . $xhourslater. "<br>"; if($now==$xhourslater) { echo "now is 3 hours later" . "<br>"; //send email follow up, then update status as sent, in order not to resend anytime in the 3rd hour. } }

    Read the article

  • Convert Date MMDDYY to Date for database Insert

    - by lesponce
    I got an array with a date set as 071712 . no / slash characters for the date, no dash. nothing, just plain 071712 (coming from a text file). I need to convert the date so I can include it in a SqlServer insert statement. I'm calling a stored procedure for the insert. So far I have this: // This is not working so far. DateTime date = Convert.ToDateTime(fileLines[4]); (date will be used as a parm for the stored procedure)

    Read the article

  • Is it possible to set the date on a Linux machine to the year 2040?

    - by Daryl Spitzer
    I need to be able to set the date on Ubuntu (8.04.4 LTS) to the year 2040 (to test something that isn't relevant to this question). Is that possible? I can run: $ sudo date -s "15 JAN 2038 18:00:00" Fri Jan 15 18:00:00 PST 2038 ...but: $ sudo date -s "15 JAN 2039 18:00:00" date: invalid date `15 JAN 2039 18:00:00' Is the limit somewhere in 2038 (or prior to Jan. 15, 2039)? Does this change with different versions of Linux?

    Read the article

  • Error loading operating system: format Windows 7 to Windows XP Service Pack 3

    - by Blerta
    I saw that there are other questions like mine here. But O also saw that some problems where solved with fixmbr from a Windows 7 recovery console, but that didn't work for me. I bought my laptop with Vista installed and later reformated and used Windows 7. During formatting with Windows 7 I had some problems with my hard drive and found out it was dead so I bought a new one. I wanted to reformat with Windows XP,because Windows 7 is consuming more RAM that it is able handle and I wanted to use it for other programs. So I formatted with Windows XP Service Pack 3 but after first reboot a message appeared: "Error loading operating system" Reading here, I assumed that maybe I had installed it on the wrong partition and maybe having two OS now, so I used fixmbr but it is still not starting up. Anyway I am sure that is not the case of two operating systems. Is there any chance that when the computer designed to work with Vista you would face problems with Windows XP? Like not recognizing a hard drive?

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >