w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
I need to generate records for current week based on today's date
This bit of code will bring you back all records within the current week. If you only want the working week (without weekends) change the *7 and +7 to *5 and +5 BETWEEN dateadd(dd,(datediff(dd,-53684,getdate())/7)*7,-53684) AND dateadd(dd((datediff(dd,-53684,getdate())/7)*7)+7,-53684)

Categories : SQL

delete date in spreadsheet prior today's date apps script
You don't show any of your data, so I'm guessing a bit. It appears that the date format of the logs in your spreadsheet is like this: Wed Jul 10 19:00:00 GMT-07:00 2013 That format is not automatically recognized as a date by Google Spreadsheets. However, it is OK for creating a javascript Date object, so we can do that for comparisons, like so: new Date("Wed Jul 10 19:00:00 GMT-07:00 2013") You've started by getting the spreadsheet data in an array, and that's good - it's quick, and we can write out the final data in one step. To remove rows from the array, use the Array.splice() method. Here's the resulting script: function killOldLogs() { var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; var data = sheet.getDataRange().getValues(); var tod

Categories : Javascript

disable dates in jquery calendar between today's date and set date and also weekends if it comes
If you want to disable weekends, jquery ui has a built in function for it. Add beforeShowDay: $.datepicker.noWeekends on datepicker init. ref: api.jqueryui.com/datepicker/ $("#departure").datepicker({ beforeShowDay: $.datepicker.noWeekends, dateFormat: "dd/mm/yy", changeMonth: true, changeYear: true, maxDate: "+1y", minDate: +4 });

Categories : PHP

disable dates in jquery calendar between today's date and set date
yes you can specify one array as range to disable like this way // Disable a list of dates var disabledDays = ["9-21-2010", "9-24-2010", "9-27-2010", "9-28-2010", "9-3-2010", "9-17-2010", "9-2-2010", "9-3-2010", "9-4-2010", "9-5-2010"]; function disableAllTheseDays(date) { var m = date.getMonth(), d = date.getDate(), y = date.getFullYear(); for (i = 0; i < disabledDays.length; i++) { if($.inArray((m+1) + '-' + d + '-' + y,disabledDays) != -1) { return [false]; } } return [true]; } $('#datepicker5').datepicker({ dateFormat: 'mm-dd-yy', beforeShowDay: disableAllTheseDays }); Here i am posing very useful LINK to disable any dates or any date range. let me know if i can help you more.

Categories : PHP

Jquery Date picker is Selecting today and default date given
What about setting the value of #OnwardTravelDate in html or jquery? HTML: <input type="text" id="OnwardTravelDate" value="25/06/2013" /> jQuery: $("#OnwardTravelDate").val("25/06/2013"); // Before datepicker code Then you don't need your defaultDate: SelectDate at all :) Hope that helps. Edit: (more info) You could also try the setDate method: $("#OnwardTravelDate").datepicker("setDate", SelectDate); // After datepicker code Edit: jsfidle This JS fidle seems to work for me: jsfiddle Maybe the styling on your theme makes it look like it's selected?

Categories : Javascript

Using ACF date picker to only show posts after today's date
I'd go for a custom query: global $wpdb; $items_per_page = 10; $offset = 0; $query = " SELECT posts.*, DATE(postmeta.meta_value) FROM " . $wpdb->prefix . "posts AS posts RIGHT JOIN " . $wpdb->prefix . "postmeta AS postmeta ON (postmeta.post_id = posts.ID) WHERE posts.post_type = 'events' AND postmeta.meta_key = 'event_date' AND postmeta.meta_value > '" . date('Y-m-d H:i:00') . "' ORDER BY postmeta.meta_value ASC LIMIT " . $offset . ", " . $items_per_page . " "; $events = $wpdb->get_results($query); foreach ($events as $event): setup_postdata($event); //event loop endforeach; wp_reset_pos

Categories : Wordpress

Why is datetime returning today's date instead of the input date?
You should be using the createFromFormat method. See: http://us2.php.net/manual/en/datetime.createfromformat.php

Categories : PHP

Get objects with date greater than today or empty date
Use Q. from django.db.models import Q @login_required def event_new(request, person_uuid=None): today = datetime.datetime.today() #valid_until may be empty profile = Profile.objects.filter(company=request.user.company).filter(Q(valid_until__gte=today)|Q(valid_until=None))

Categories : Python

Is item date within 5 days of today's date
I tried the solution in the question that @abc123 commented and got the numerical timestamp- based difference between 5 days. I also updated the way I got today's date. Less code. $('td:contains("Scheduled")').parents('tr').addClass('scheduled'); $("td.time").each(function (index) { var date = $(this).text(); var oppTime = date.substring(0, 10); var d = new Date(); var today = d.toJSON(); var t = today.substring(0, 4) + "/" + today.substring(5, 7) + "/" + today.substring(8, 10); var timeStamp_oppDate = new Date(oppTime).getTime(); var timeStamp_thisDay = new Date(t).getTime(); var timeDiff = timeStamp_oppDate - timeStamp_thisDay; if (432000000 >= timeDiff) { if (!$(this).parents('tr').hasClass('scheduled')) { $(this).parents('t

Categories : Javascript

Fullcalendar (full calendar) Not defaulting to display the current today's date. Month shows february and not today's
it is because of the month option you are setting, it is used to set The initial month when the calendar loads. Try $(document).ready(function() { $('<?php echo $calendar ?>').fullCalendar({ header: { left: 'prev, next today, agenda', center: 'title', right: 'month, agendaWeek, agendaDay', ignoreTimezone: false }, // Multiple Sources eventSources: [ '<?php echo get_option('fc_option_feed1'); ?>', '<?php echo get_option('fc_option_feed2'); ?>', '<?php echo get_option('fc_option_feed3'); ?>' ], events: { //http://www.google.com/calendar/feeds/centre.edu_5f119bnujdfol3gs59h0driv9c%40group.calenda

Categories : Jquery

How to display difference between past date and today's date and display them as months and days using jquery
lyour problem seems more of Javascript nature than JS, simply parse the input date, substract the getTime() of that and current time and divide to get months and days var date = new Date(text.value); var now = new Date(); var difference = now.getTime() - then.getTime(); /*milliseconds*/ var DayMilliseconds = 24 * 60 * 60 * 1000; var MonthMilliseconds = 30 * DayMilliseconds ; var months = Math.floor( difference / MonthMilliseconds ); var remaining = difference % MonthMilliseconds ; var days = Math.floor( remaining / DayMilliseconds );

Categories : Jquery

Determine how many days into the year a certain date is when the date is determined by a variable
You are complicating things too much. DateDiff can perform the calculations you want: Dim iniDate As Date, curDate As Date Dim ValueA As Integer, Año As Integer Año = 2010 iniDate = Format(CDate("01/01/" & Año), "MM/dd/yyyy") 'You can change the Format curDate = Format(CDate("01/05/" & Año), "MM/dd/yyyy") ValueA = DateDiff("d", iniDate, curDate) 'RESULT -> 4

Categories : Excel

copy date from one table to another It becomes part of table on the Delivery Date
Try this INSERT INTO ProductDistribution (ProuductID, ProductName , DateOrdered) AS SELECT ProductID, ProductName, DateOrdered FROM Products WHERE DateDelivered = getdate()

Categories : SQL

How to determine if a date is more than three months past current date
Use strtotime(), like so: $today = time(); //todays date $twoMonthsLater = strtotime("+3 months", $today); //3 months later Now, you can easily compare them and determine.

Categories : PHP

Excel VBA - How to compare today's date in one column with a future date in a second column
First of all, you need to understand how does VBA "understands" a date. Excel, Access, VBA and many MS products store dates as a double precision number; the integer part of the number is the date (number of days counted since January 1st, 1900), and the decimal portion of the number is the time (fraction of day). This makes it easy to compare two dates: You can compare, add or substract dates just as if you were using numbers. So, if t0 and t1 are two dates (t1 >= t0), then the expression t1 - t0 will give you the difference of days. Now... how yo count the "business days" between two dates? The format() function in VBA can help you. You can use this function to return the "day-of-week" number. Check the online help of the function: http://msdn.microsoft.com/en-us/library/office/gg2

Categories : Excel

Joining the correct budget date range fields based on the date of a service
you can use the BETWEEN clause on a.ID=b.ID AND DOSStart BETWEEN Start_DT AND End_DT . try this: CREATE TABLE #Service_Budget( ID int, SERV_Type int, Start_DT datetime, End_DT datetime, Budget int, NUMBER_OF_MONTHS_OF_SERVICES int ); INSERT INTO #Service_Budget VALUES (13946, 5, '4/2/2012', '4/2/2013', 622.4, 12), (13946, 5, '4/2/2013', '4/2/2014', 788.4, 12) CREATE TABLE #Service_Visits( ID int, Service_Type int, DOSStart datetime, BillableUnits int, RATE_AMOUNT int ); INSERT INTO #Service_Visits VALUES (13946, 5, '4/15/2013', 3,75.5) SELECT a.ID, a.Service_Type, a.DOSStart, MONTH(a.DOSStart) AS Month, YEAR(a.DOSStart) AS Year, MONTH(b.START_DT) AS Start_Month, YEAR(b.START_DT) AS Start_Year, b.Start_DT, b.End_DT,

Categories : SQL

SharePoint 2013: Making a predetermined Due Date based on Created Date
I found the answer: I made a Date and Time column that auto-populated Today's Date, called "Milestone Start". Then I made a Number column that only took whole numbers, called "Milestone Gap". Then the final column, I made a Calculated column, called "Milestone Due Date", with the following formula: =TEXT([Milestone Start]+[Milestone Gap],"mm/dd/yyyy") The returned data type is set to "Single line of text" and works exactly as intended.

Categories : Sharepoint

With 2 dates I need to block the datepicker option for 2nd date based on 1st date selection
Assuming you're using jQuery UI's datepicker, I think you're looking for Date range. You'd have a markup like this : <label for="from">From</label> <input type="text" id="from" name="from" /> <label for="to">to</label> <input type="text" id="to" name="to" /> Then, in the JS, $(function() { $( "#from" ).datepicker({ //not needed defaultDate: "+1w", //to show the month dropdown changeMonth: true, //the number of months to be shown when input is focussed numberOfMonths: 1, //**Important!** onClose: function( selectedDate ) { //dynamically set min-date of second datepicker to selected date in the first datepicker $( "#to" ).datepicker( "option", "minDate", selectedDate ); } }

Categories : Javascript

updating a date format in mysql based on empty date field
Since it runs daily, you could just say where end_time < now() - INTERVAL 24 HOUR and start_time >= now() - INTERVAL 24 HOUR; Ok, updated a sample fiddle for you using timestamp -> http://sqlfiddle.com/#!2/bbdfe/1 Probly the best thing to do is to change your default from '0000-00-00 00:00:00' which isn't valid for a timestamp field to a valid time -> 1970+ and all your problems will then go away.

Categories : Mysql

Calculate End Date, based on start date and drop down list of number of Package in cakephp
in view page <script type="text/javascript"> $(function() { $( "#start_date" ).datepicker({ dateFormat:'yy-mm-dd' }); $( "#end_date" ).datepicker({ dateFormat:'yy-mm-dd' }); $('#start_date').bind('change', function() { $.ajax({ sync: false, type: 'POST', data: 'subscription_id=' + $("#packagename").val() + '&start_date=' + $("#start_date").val(), url: '<?php echo Router::url(array('controller' => 'Subhistories', 'action' => 'diff'), true); ?>', success: function(e) { $('#end_date').val(e); } }); return false; }); }); </script> create one function in controller likde diff() {

Categories : Jquery

Batch script to delete files older than X days (based on creation date, not modified date)
See if this helps - Keep the 5 *.config files (skip=5) with the most recent creation date Test it on sample files. @echo off pushd "d:folder" del file2.tmp 2>nul for /f "delims=" %%a in ('dir *.config /b /a-d ') do call :getcreationdate "%%~fa" sort /r <file2.tmp >file.tmp for /f "skip=5 tokens=1,*" %%a in (file.tmp) do del "%%~b" del file.tmp file2.tmp popd pause goto :EOF :getcreationdate set "file=%~1" set "file=%file:=\%" WMIC DATAFILE WHERE name="%file%" get creationdate | find "." >file.tmp for /f %%b in (file.tmp) do set dt=%%b set dt=%dt:~0,8%_%dt:~8,6% del file.tmp >>file2.tmp echo %dt% "%~1"

Categories : Windows

How to insert date and retrieve records based on that entered date
Though it is not best to have functions in the fields in the where clause (performance wise) this will do the job. "SELECT id,today FROM tbl_demo WHERE CONVERT(DATETIME,CONVERT(VARCHAR,today,120)) = CONVERT(DATETIME,CONVERT(VARCHAR,'" & Ddate.ToString() & "',120))" An alternative would be providing the Date directly to ISO format: "SELECT id,today FROM tbl_demo WHERE CONVERT(DATETIME,CONVERT(VARCHAR,today,120)) = CONVERT(DATETIME,CONVERT(VARCHAR,'" & Ddate.ToString("yyyyMMdd") & "',120))" I am not sure if it is yyyyMMdd or yyMMdd for SQL CE, so better try both. According to this MSDN article it should be "yyMMdd" but it could be a typo...

Categories : Database

Free Pascal use for loop to determine visibility of component based on status of Date Component
You can iterate over the components via FindComponent. In the example below Self as the Form is given as Owner. Procedure SetChecks(AOwner:TComponent); var x:Integer; begin for x:=1 to 5 do TCheckBox(AOwner.FindComponent('check' + IntToStr(x))).Visible := TDateEdit(AOwner.FindComponent('date' + IntToStr(x))).Date <>StrToDateTime('00:00:00'); end; procedure TForm1.Button1Click(Sender: TObject); begin SetChecks(Self); end;

Categories : Delphi

Calculate date based on pattern from anchor date
While I'm not 100% sure I understand where July 29th comes from, if you want to retrieve the closest date 28 days from an anchor date, one way would be to use a recursive CTE (although it could have a performance implication). declare @anchor datetime set @anchor = '6/30/2013' ;with cte as ( select @anchor dt union all select dateadd(day, 28, dt) dt from cte where dt <= dateadd(day, -28, '8/7/2013') ) select max(dt) from cte SQL Fiddle Demo Perhaps an even simpler solution would be to use datediff as well: declare @anchor datetime set @anchor = '6/30/2013' select dateadd(day, 28 * (datediff(day, @anchor, getDate())/28), @anchor) More Fiddle

Categories : SQL

Get a previous date based on a future date using Javascript
You can tweak your function to include this: function getWednesday(date) { var d = (date.getDay() == 0 ? 6 : date.getDay() - 3); date.setTime(date.getTime() - (d * 24 * 60 * 60 * 1000)); return new Date(date.getFullYear(), date.getMonth(), date.getDate()-7); } alert(getWednesday(new Date())); I think that should work.

Categories : Javascript

PHP Today's date in form
Try with either one like PHP in HTML : <input type="text" value="<?php echo date('m/d/y');?>"/> HTML in PHP : <?php echo "<input type='text' value='".date('m/d/y')."'";?> Dont mesh both PHP and HTML and another is better to write HTML in lower cases.

Categories : PHP

Possible to put today's date as an alias?
I think you are just thinking about this backwards. Why not just alias the output of the date? I cannot see a benefit...which is probably why it is not allowed Date() AS Today

Categories : SQL

clj-time always returns today's date.
When using clj-time with a database, I've found that I need to use the functions to-sql-date and from-sql-date in the coerce namespace (source here: https://github.com/clj-time/clj-time/blob/master/src/clj_time/coerce.clj) This is because, as @noisesmith mentioned in his comment, most clojure sql libraries will give a date object (specifically, a java.sql.Date) for a date field in the db. This needs to be treated slightly differently from a string in order to get something that plays nice with clj-time. Assuming your date is indeed a java.sql.Date, the following should do the trick... (ns mr.layouts (:require [clj-time.format :as ctf] [clj-time.coerce :as coerce])) (def to-mdy (ctf/formatter "MMMM d, yyyy")) (defn coerce-mdy [sd] (ctf/unparse to-mdy (coerce/from-sql-d

Categories : Clojure

Select from database where date = today
The above code will give you the current date NSDate* date = [NSDate date]; NSDateFormatter* formatter = [[NSDateFormatter alloc] init]; NSTimeZone *destinationTimeZone = [NSTimeZone systemTimeZone]; formatter.timeZone = destinationTimeZone; [formatter setDateStyle:NSDateFormatterLongStyle]; [formatter setDateFormat:@"dd/MM/yyyy"]; NSString* dateString = [formatter stringFromDate:date]; NSLog(@"tha date is..%@",dateString); and your select Query will be like this NSString *queryString = [NSString stringWithFormat:@"select * from records where date ='%@'", dateString]; const char *sqlStateMent = [queryString UTF8String];

Categories : IOS

Setting today's date in XAML
you have to include this name space in your xaml..if you are not able to show date.. xmlns:sys="clr-namespace:System;assembly=mscorlib" and if you want something different update your question..

Categories : Xaml

Replace CSS after compare today's date in Javascript
First I would give your another class to reference by, say "table_row". Then when you want to switch classes use the following code. $(".table_row").removeClass("dateStyleBlue"); $(".table_row").addClass("dateStyleRed"); Remember to use the dot to reference by class!

Categories : Javascript

Sort List by dates when the first date is today
Create today's date outside the comparator, and change your comparator to compare absolute differences for the dates it compares, like this: final long todayTime = new Date().getTime(); Collections.sort(unsortedDates, new Comparator<Item>() { public int compare(Item m1, Item m2) { long dist1 = Math.abs(todayTime-m1.getDate().getTime()); long dist2 = Math.abs(todayTime-m2.getDate().getTime()); return Long.compare(dist1, dist2); } });

Categories : Java

Android Display date from today to last 50 years
You probably wanted to say year.setViewAdapter(new DateNumericAdapter(context, Year , Year - NoOfYear, NoOfYear)); instead of year.setViewAdapter(new DateNumericAdapter(context, Year , Year + NoOfYear, NoOfYear));

Categories : Android

file exists with condition today's date
@ECHO OFF SETLOCAL enabledelayedexpansion SET yyyy=2013 SET mm=07 SET dd=22 SET count=0 FOR /f %%g IN ('dir /b /a-d *%yyyy%%mm%%dd%????.csv') DO ( SET filename=%%~ng SET filename=!filename:~-12,-4! if "!filename!"=="%yyyy%%mm%%dd%" SET /a count+=1 ) ECHO %count% GOTO :EOF I've simply set yyyy,mm,dd to constants, obviously - just poke your date-decoder in as appropriate. Note that you could prefix the filemask with a directoryname if required - and enclose the entire filemask in "rabbit's ears" if there are spaces or other confounding characters in the resultant mask. Important: the filemask is merely a primary filter. The dir would list a file named filename_ver2013040512132.csv for instance (1 digit missing...) so the gymnastics with the processing would still be required. I'm als

Categories : Batch File

Rails: Where Date.today is past OR is the :deadline_date
To do OR statements with Rails, I always use squeel. Should be something like @email_reminder = ToDo.where{ (:reminder => true) | (:deadline_date =< Date.today) } EDIT: I've never seen the comma used to separate the two parts of the query (not sure that's possible), I would do it like this (2 where clauses are joined by AND in ActiveRecord: @email_reminder = ToDo.where(:reminder => true).where({ deadline_date <= Date.today }) Without squeel it would be something like .where("deadline_date <= ?", Date.today) Also, notice I flipped the = and < sign in the query

Categories : Ruby On Rails

Sort clanwars by date, without showing before today
$ergebnis=safe_query( "SELECT * FROM ".PREFIX."clanwars WHERE `date` > DATE(NOW()) ORDER BY `date` ASC LIMIT 0, ".$maxresults); NOW() returns the current date and time, DATE() returns just the date part, which is equivalent to 2013-09-12 00:00:00.

Categories : PHP

How to export table data to csv where date 'today'
SELECT 'Title', 'Date', 'Count' UNION ALL SELECT Title,Date,Count FROM sales_com WHERE Date >= to_date('2004/01/01', 'yyyy/mm/dd') AND Date <= to_date('2004/12/31','yyyy/mm/dd'); INTO OUTFILE 'U:/CSV-LiveDB-Upload/sales_com/Data.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY ' ';

Categories : Mysql

Sql query for selecting entries with today's date
Assuming the dates are indeed of type DateTime, what you could do in this case is to use dateadd and datediff. Run these two statements: -- Todays date, date part only select dateadd(dd, 0, datediff(dd, 0, getdate())) -- Tomorrows date, date part only select dateadd(dd, 0, datediff(dd, 0, dateadd(dd, 1, getdate()))) Using those two, you can do this (Including edits, thanks @gvee) select * from act_events where e_start >= dateadd(dd, 0, datediff(dd, 0, getdate())) and e_end < dateadd(dd, 0, datediff(dd, 0, getdate()) + 1) I should mention that getdate() is a built-in function in SQL Server. You could of course change this to a variable if you are using this in a stored procedure for example. As a side note, the date in SQL Server is actually a number. T

Categories : SQL

Turn on Today button on date picker
Try this: $(".datepicker").datepicker({ showOn: "button", showButtonPanel: true, buttonImage: buttonCalendar, buttonImageOnly: true, buttonText: "" }); and call this js code in the pages where you have the calendar. $.datepicker._gotoToday = function(id) { $(id).datepicker('setDate', new Date()).datepicker('hide').blur(); };

Categories : Jquery

Mysql select record that should have today and tomorrow date
You can use: NOW() + INTERVAL 1 DAY If you are only interested in the date, not the date and time then you can use CURDATE instead of NOW: CURDATE() + INTERVAL 1 DAY your query should be SELECT `availibility`.* FROM (`availibility`) WHERE `property_id`= 8818 AND (availibility.unavailibility_date between CURDATE() AND CURDATE() + INTERVAL 1 DAY // change here

Categories : PHP



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.