Menu
  • HOME
  • TAGS

How to change date-time format?

sql-server,date,datetime,sql-server-2014

You need to determine the format of the value you are converting before you can convert it. If it's simply between those two formats, you can simply search for - to determine it's format. I would also suggest storing the value in a datetime column as opposed to a varchar,...

INDEX/MATCH for closest value to a certain date

excel,date,excel-formula,worksheet-function,array-formulas

Following 4 named ranges for simplicity in code: "Dividends": DividendDates (column A); DividendsPaid (column B) "AdjClose": StockDate (column A); StockPrice (column B) try (in column C in "Dividends": {=INDEX(StockPrice;MATCH(MAX(IF((StockDates<=A1);StockDates));StockDates;0))} Assuming that the dividend date for which you want to find the adjusted stock price is in cell A1. And copy...

SQL Display DATE

sql,date

See Add> lines for changes that you need to make. SELECT Add> [VendasPOS_Cabecalhos].[DATA] as Day, COUNT(DISTINCT CASE WHEN MinProduto = 1 AND MaxProduto = 1 THEN PRENUMERO END) AS QtdCombustivel ,COUNT(DISTINCT CASE WHEN MinProduto <> 1 AND MaxProduto <> 1 THEN PRENUMERO END) AS QtdLoja ,COUNT(DISTINCT CASE WHEN MinProduto =...

Get next month using mktime()

php,date,mktime

If you insist on using your version, then it should be %m instead of %d, i.e.: $year = 2015; $month = 6; echo strftime('%m/%Y', strtotime('+1 month', mktime(0,0,0,$month,1,$year))); ...

MySQLi “CURRENT_MONTH_BEGINNING”… is there a way to get that?

php,date,mysqli

You can just use the current year and month, and 01 as the day: SELECT count(DISTINCT ip) AS visitor_ip FROM visitor_list WHERE visited_date > CONCAT(DATE_FORMAT(NOW(),'%Y%m'), '01') This has the advantage that any index on visited_date will still be used correctly....

Elasticsearch NumberFormatException when running two consecutive java tests

java,date,elasticsearch,numberformatexception,spring-data-elasticsearch

Since the exception complains about a NumberFormatException, you should try sending the date as a long (instead of a Date object) since this is how dates are stored internally. See I'm calling date.getTime() in the code below: SearchQuery searchQuery = new NativeSearchQueryBuilder() .withQuery(matchAllQuery()) .withFilter(rangeFilter("publishDate").lt(date.getTime())).build(); ...

Count Down 1 Day for Each Row mysql

mysql,date

Try UPDATE products JOIN (select @date := '2015-06-15 11:31:31') d SET dateAdded = (@date := @date - INTERVAL 1 DAY) ...

How to set current date with HTML input type Date Tag

php,html,date

Try using date function as <input type="date" value="<?php echo date('Y-m-d');?>"> ...

How do I change chromes Date-parsing / Sorting to match ff/ie Dateparsing?

javascript,jquery,google-chrome,date,momentjs

The problem you are facing is most likely caused by the fact, that different browser (engines) implement different algorithms for sorting. The differences you experience are (at first glance) all focused on elements that have no difference (e.g. 0 returned from your sort-function) and thus have no deterministic sort-behavior described....

PHP Timezone not working correctly

php,date,time,timezone

You're not quite handling timezones correctly // set the datetime in the EDT timezone $schedule_date = new DateTime("2015-06-22 13:00:00", new DateTimeZone("America/New_York") ); echo $schedule_date->format('Y-m-d H:i:s T'). " <br />"; // 2015-06-22 13:00:00 // change it to CDT $schedule_date->setTimeZone(new DateTimeZone('America/Chicago')); echo $schedule_date->format('Y-m-d H:i:s T'). " <br />"; // 2015-06-22 12:00:00 Demo...

comparing two dates. Equal isn't working as well

sql,date,ms-access,compare,equals

The Date/Time value #2015.06.11# includes a time component, which is 12:00 AM. If any of your stored values for that date include a time component other than 12:00 AM, they will be excluded by your WHERE clause. Use a modified WHERE clause to retrieve all the rows for your target...

Date formatting - making dd/m/yyyy into dd/mm/yyyy

excel-vba,date,format

Use String Sub dural() Dim lastdaylastmonth As String lastdaylastmonth = Format(DateSerial(Year(Date), Month(Date), 0), "dd/mm/yyyy") MsgBox lastdaylastmonth End Sub ...

Convert strings of data to “Data” objects in R [duplicate]

r,date,csv

If you read on the R help page for as.Date by typing ?as.Date you will see there is a default format assumed if you do not specify. So to specify for your data you would do nmmaps$date <- as.Date(nmmaps$date, format="%m/%d/%Y") ...

I need to dynamically set the date in a where statement to only pull results from a table to occur in County's fiscal year

sql,sql-server-2008,date,datetime,visual-studio-2008

Use datepart year, so your not performing a search on a function I'd reccomend setting up some variables that wil beset prior to the main query running, so your sarg is against a date. declare @fiscalStart = select cast('07/01/' + Cast((datepart(year, getdate())-1) as varchar(4)) as datetime) declare @fiscalEnd = select...

Oracle SQL PreparedStatement setdate

java,sql,oracle,date

Try setting the date format explicitly with the SQL statements using TO_DATE, e.g. String query = "INSERT INTO STUDENTS VALUES (?,?,?,TO_DATE(?,'YYYY-MM-DD'),?,?,?,?)"; Then ensure the date format in the Java variable matches. Change the format in the TO_DATE as required if different....

Creating javascript dates object

javascript,date,object

You need to reset the date, or they will be references of the same Date object. var dates = []; getDateRange(); function getDateRange() { var today = new Date(); var date; for (var i = 0; i <= 59; i++) { date = new Date(); date.setDate(today.getDate() + i); console.log(date); dates.push(date);...

date -d not working on mac

linux,osx,date

You should try it this way date -j -f "%Y-%m-%d %H:%M" "2015-06-11 12:39" +%s. I've just tried it myself. The commands for date are a bit different on macs than on a Linux based operating system....

Query Builder for DATE type

c#,date,query-builder

You have to declare a string variable, and it will work! private void button1_Click(object sender, EventArgs e) { string your_string = dateTimePicker1.Value.ToString(); try { this.examinesTableAdapter.FillBy(this.dbSpinDataSet.examines, your_string, textBox2.Text, textBox3.Text); } catch (SystemException ex) { System.Windows.Forms.MessageBox.Show(ex.Message); } } ...

Is there a single DateTime Picker component for gwt?

java,date,datetime,gwt

This picker might suit your needs, further answers can be found regarding this familiar question.

oracle sql - finding entries with dates (start/end column) overlap

sql,oracle,date,range

I would start with this query: update table t set cancelled = true where exists (select 1 from table t2 where t.end_date > t2.start_date and t.uid = t2.uid and t.id < t2.id ) An index on table(uid, start_date, id) might help. As a note: this is probably much easier to...

Convert Strings To Date In VBA In A for Each Loop

string,excel,vba,date

Try this: MyCell.Value = Format(MyCell.Value, "mmmm dd, yyyy")...

sql server query current date from database [duplicate]

sql,sql-server,date

If you are looking for the current date: WHERE TransactionDate = cast(getdate() as date) Or if you prefer ANSI standards: WHERE TransactionDate = cast(CURRENT_TIMESTAMP as date) ...

PHP Convert date using strtotime? [duplicate]

php,date

You want DateTime::createFromFormat() (http://php.net/manual/en/datetime.createfromformat.php). Using that you can convert a string to a datetime any way you want to.

ACCESS 2007 - Form / subform filtering between dates

vba,date,ms-access,filter

You need proper date formatting: strFilterNaklady = "[datNakladDatum] Between #" & Format(datRokMesiacOd, "yyyy\/mm\/dd") & "# And #" & Format(datRokMesiacDo, "yyyy\/mm\/dd") & "#" Also, this can be reduced to: datRokMesiacDo = DateSerial(Year(cmbStavK), Month(cmbStavK) + 1, 0) 'end Date ...

Difference in years between two dates

sql,postgresql,date

There are number of things wrong here. select DATEDIFF ^^^^ PostgreSQL doesn't have a datediff function. regress-> \df datediff List of functions Schema | Name | Result data type | Argument data types | Type --------+------+------------------+---------------------+------ (0 rows) I think you want the - operator, the extract function, justify_interval and...

Extracting multiple variables from a changing string in bash

python,string,perl,date,datetime

Here is the perl code that I think will work for you. #!/usr/bin/perl my $string = <STDIN>; chomp $userword; # Get rid of newline character at the end @arr = $string =~ /(passed|failed).+?([\d]+[yY].)?([\d]+(?:mo|MO).)?([\d]+[dD].)?([\d]+[hH].)?([\d]+[mM].)?([\d]+[sS])/g; $arr_len = scalar @arr; print "Result: $arr[0]\n"; for($i=1;$i<=$arr_len;$i=$i+1){ $arr[$i]=~/(\d+)([A-Za-z]*)/g; if ( $2 eq "y" | $2 eq...

NSDateFormatter doing wrong

swift,date,nsdateformatter

You just need to set the locale identifier to "pt_BR" // this returns the date format string "dd 'de' MMMM 'de' yyyy" but you still need to set your dateFormatter locale later on let br_DateFormat = NSDateFormatter.dateFormatFromTemplate("ddMMMMyyyy", options: 0, locale: NSLocale(localeIdentifier: "pt_BR")) let dateFormatter = NSDateFormatter() dateFormatter.dateFormat = br_DateFormat dateFormatter.locale...

Format date (with different input) php

php,date,format,multilingual,jquery-validation-engine

I know that Zend has some of this logic in there zend_date (requires Zend Framework ^^), but I would just use a simple solution like this: (where you get the format from a switch statement) $date = $_POST['date']; $toConvert = DateTime::createFromFormat('d-m-Y', $date); switch($lang){ case 'de': $format = 'Y-m-d'; break; default:...

Why is R (in my example) very slow for handling dates/datetimes?

r,performance,date,datetime

A format function that can return many different formats, can be expected to be quite slow. If you are happy with lubridate's year function, you could just use its (very simple) code: as.POSIXlt(x, tz = tz(x))$year + 1900 In general, you should avoid conversions between any types/classes and characters when...

Add days, weeks, months to date using jQuery

jquery,date

jQuery is not for DateTime manipulation. It's for querying and manipulating DOM objects. For what you need, you can either implement that yourself, or use a specialized third-party library. Moment.js is pretty neat. Examples: moment().subtract(10, 'days').calendar(); // 06/12/2015 moment().subtract(6, 'days').calendar(); // Last Tuesday at 1:51 PM moment().subtract(3, 'days').calendar(); // Last...

Can someone explain this odd javascript date output?

javascript,date,datetime,time

The month parameter to the Date constructor is 0 indexed, so 5 is June, which only has 30 days.

Select before specific date from one day only

mysql,sql,date

If I understand correctly, you want to receive one days worth of rows before a given date. I think that would be: SELECT t.* FROM table t WHERE date = (SELECT MAX(t2.date) FROM table t2 WHERE t2.`date` < '2015-06-07') ...

php why do i allways get a 1 on date [duplicate]

php,date,time

http://php.net/manual/en/function.date.php Second parameter of date function should be in Unix Time Stamp format....

Java Date “before” method dont exist [on hold]

java,date,netbeans

data2 is a String. before is a method of Date class. You should parse data2 into a Date instance and call date2.before(now) (assuming date2 is a Date)....

python - how to check whether some given date exists in netcdf file

python,date,select,netcdf

Ok, this is not good style but it might get you what you want. Assuming your times are strings and you are confident that plain string comparison would work for you, you could do something like this: timesteps = ncfile.variables['time'] dates_to_skip = set(['June 23th', 'May 28th', 'April 1st']) filtered_timesteps =...

Excel formula to check blank in range bases on criteria

excel,date

Use =SUMPRODUCT((K2:NK2="")*(K1:NK1<=I2)*(K1:NK1>=G2)) if you want to include the start and end date, if you want to include them, use =SUMPRODUCT((K2:NK2="")*(K1:NK1<I2)*(K1:NK1>G2)).

Selecting between dates in mysql

mysql,date

Looks like you want to find a jobs record with the largest start_date that's also less than $delivery_date. Here's the query SELECT no FROM jobs WHERE `start_date` < $delivery_date ORDER BY `start_date` DESC LIMIT 1 If $delivery_date is set to 2010-02-08, the above query will return 198 like you expected....

IE Input type Date not appearing as Date Picker

internet-explorer,date,datepicker

You need to use a ployfill so that the input type DATE has a consistent behaviour in all browsers. You can use this webshim as a polyfill. Input type DATE is an HTML5 feature which is not supported by all browsers. In case you want to use HTML5 feature not...

Get dates in “human readable” format

php,symfony2,date,fosrestbundle

If it's a DateTime() object, and I assume it is, you should be able to do: $entEmail->getCreatedAt()->format('Y-m-d H:i:s') More information on DateTime::format()...

How to get dates between two dates

php,date

Try this PHP code: <?php $scheduleStartDate = '2015-06-20'; $scheduleEndDate = '2015-06-25'; $Date = getDatesFromRange($scheduleStartDate, $scheduleEndDate); $Date = substr($Date, 0, -1); function getDatesFromRange($start, $end){ $startDate = new DateTime($start); $endDate = new DateTime($end); $endDate->modify('+1 day'); $daterange = new DatePeriod($startDate, new DateInterval('P1D'), $endDate); $result = ''; foreach($daterange as $date){ $result .= '"'.$date->format("j-n-Y").'",'; }...

How to compare two dates in moment.js [duplicate]

javascript,jquery,angularjs,date,momentjs

You could pass in 2 dates from your server: the existing timestamp, and the server's "now" timestamp. Then (assuming your server passes in its timestamp in the same format) you can use .from() instead of .fromNow() do: moment(time, "YYYY-MM-DD HH:mm:ss.SSSSSS").from(serverTime, "YYYY-MM-DD HH:mm:ss.SSSSSS"); If this is the only thing you're using...

need the way to put Date in Parse.com without Time and the opposite

android,date,time,parse.com

What I finally did. I used Calender class and filled each item(year, month, day, hour, minute) while using date and time pickers. And used Calendar.getTime method to transform it to Date class that Parse.com understand. Calendar mDateTime = Calendar.getInstance(); ... mDateTime.set(Calendar.YEAR, selectedYear); mDateTime.set(Calendar.MONTH, selectedMonth); mDateTime.set(Calendar.DAY_OF_MONTH, selectedDay); ... meeting.put(ParseConstants.KEY_DATETIME, mDateTime.getTime()); So...

Get n data based on the same day (timestamp)

mysql,timestamp,date

Let's say you want the see the number of sensor data point for the last week SELECT DATE(timestamp) dt, COUNT(1) datapoints FROM sensor WHERE timestamp >= DATE(NOW()) - INTERVAL 1 WEEK + INTERVAL 0 SECOND GROUP BY DATE(timestamp); To see this month by day SELECT DATE(timestamp) dt, COUNT(1) datapoints FROM...

AppleScript (or swift) add hours to time

swift,date,applescript

You need to pick the hours as an individual variable, like shown below: set currentDate to current date set newHour to ((hours of currentDate) + 8) You can also use this for days, minutes and seconds. This will work. You can then use the variables to construct a new date...

How to most efficiently convert a character string of “01 Jan 2014” to POSIXct i.e. “2014-01-01” yyyy-mm-dd

regex,r,date,posixct

What about using lubridate: x <- "01 Jan 2014" x [1] "01 Jan 2014" library(lubridate) dmy(x) [1] "2014-01-01 UTC" Of course lubridate functions accept tz argument too. To see a complete list of acceptable arguments see OlsonNames() Benchmark I decided to update this answer with some empirical data using the...

Retrieve the date portion of date object in milliseconds

javascript,date,datetime,angular-ui-bootstrap,milliseconds

getMilliseconds() returns the milliseconds part of the date, which is 0 is your case, since you constructed it from the date part (only) of a date. If I understand the requirement correctly, you're trying to get the date's representation as the number of milliseconds from the epoc. This is done...

Date regex python

python,regex,date

Use the search method instead of match. Match compares the whole string but search finds the matching part.

how to add Hours to date in swift in this format “2015-06-11T00:00:00.000Z” as in one string while parsing in SWIFT

ios,iphone,swift,date,nsdate

You can do it using NSCalendar method dateBySettingHour as follow: let df = NSDateFormatter() df.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z" if let dateFromString = df.dateFromString("2015-06-11T00:00:00.000Z") { let hour = 4 if let dateFromStringWithTime = NSCalendar.currentCalendar().dateBySettingHour(4, minute: 0, second: 0, ofDate: dateFromString, options: nil) { let df = NSDateFormatter() df.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z" let resultString...

sqlite Select specific day of specific month and none specific month

sql,sqlite,date,timestamp

You could just use a LIKE clause for this. Also your between won't work for edge cases if you have milliseconds after :59. WHERE t LIKE '2015-08-01 %' and: WHERE t LIKE '2015-%-12 %' Also, regarding optimization, timestamp or similar has text affinity (even though the docs seem to allude...

SAS Macro to Combine Municipal Proc SQL Statements Based on Date Criteria

date,sas,sas-macro

I would do this in a bit different manner. You can do it in a few ways, but maybe one SQL step and one datastep would be easiest. proc sql; create table lookup_lastdate as select customer_id as start, max(transaction_Date) as label, 'LASTDATEF' as fmtname from transaction_vw group by customer_id; quit;...

How to validate an input date from individual day, month, year input in Laravel 5

php,date,laravel-5

Laravel using the strtotime and checkdate functions to validate a date. How the validateDate function of Laravel works? An example: strtotime('30-2-2015'); // returns a timestamp checkdate(2, 30, 2015); // returns false // laravel raises an error Therefore, the value of $data['date_of_birth'] should be a string in a particular format. public...

Group By Date and SUM int - Date formatting and Order

sql-server,date,casting,order,group

If you really need to apply different formatting, you can do it using a derived table: select DATENAME(MM, [date]) + ' ' + CAST(DAY([date]) AS VARCHAR(2)) AS [DD Month], total_quantity from ( SELECT CAST([Datetime] AS DATE) AS [date], SUM(quantity) as total_quantity FROM Invoice_Itemized ii INNER JOIN Invoice_Totals it ON it.Invoice_Number...

Regex pattern for date and hour

regex,date,time

That's fairly correct, but you can adjust things to make them more realistic. "[0-2]?[0-9]:[0-5][0-9]" would be more realistic for time, as there is no 32:79 and what not. Also, the first can be optional to make 8:00 viable. [0-3]?[0-9]\/[0-1]?[0-9]\/[1-2][0-9][0-9][0-9] for date, as there can be no 42th of april and...

So I'm tring to get a date as a string at the command line and convert it into milliseconds but it keeps adding five hours. Any ideas why?

java,parsing,date,simpledateformat

I'm going to guess you're in the Eastern time zone and are confusing EDT with GMT.

How to format the given time string and convert to date/time object

java,date,datetime,datetime-format

You format string has a couple of mistakes: Y means the week year, not the year, which is y D means the day of the year. You should have used d, which means the day of the month. h means a 12-hour notation time of day. Since you have 14...

SQL Server / C# : Filter for System.Date - results only entries at 00:00:00

c#,asp.net,sql-server,date,gridview-sorting

What happens if you change all of the filters to use 'LIKE': if (DropDownList1.SelectedValue.ToString().Equals("Start")) { FilterExpression = string.Format("Start LIKE '{0}%'", TextBox1.Text); } Then, you're not matching against an exact date (at midnight), but matching any date-times which start with that date. Update Or perhaps you could try this... if (DropDownList1.SelectedValue.ToString().Equals("Start"))...

rails how to save date_select field value in date field in db

date,ruby-on-rails-4

Try saving it like this @user.brithdate = Date.new(params[:user]["birthdate(1i)"].to_i,params[:user]["birthdate(2i)"].to_i,params[:user]["birthdate(3i)"].to_i) @user.save ...

JavaScript Date mismatch after being stored as string [duplicate]

javascript,string,date,gettime

Duplicate of: JavaScript Date Object Comparison This is because ls_a is a different object than a when you call .getTime() you are getting a string which isn't compared as an object ...

Convert March 2015 to 03/2015 and make into date

mysql,date

STR_TO_DATE works for me with a format of '%M %Y': mysql> select str_to_date('July 2015', '%M %Y'); +-----------------------------------+ | str_to_date('July 2015', '%M %Y') | +-----------------------------------+ | 2015-07-00 | +-----------------------------------+ 1 row in set (0.10 sec) Expand your question if there's some reason you can't do the same. To turn that into...

Don't understand tm_struct (C++) calculations - is there an offset of some kind? [closed]

c++,date,datetime

From the documentation on tm we can see that: tm_year is years since 1900, not the current year number, i.e. it should be 115 this year. tm_mon is months since January (range 0-11), not the number of the month. So what you need is: std::cout << 1900 + nowTm->tm_year <<...

I had assigned Varchar for date and It's not working when I select between range of dates [closed]

sql-server,date

The reason that they are not working is because you use the wrong data type in the first place. Never use Varchar to store date or values. Always use the appropriate data type for your data (in this case, Date seems to be what you are looking for, assuming your...

How to set day of the week in Bulgarian language

php,date

Datetime format doesnt support locales, you have to convert to timestamp to use strftime Use LC_TIME in setlocale only to change the settings for time related formats <?php $now= new DateTime('now'); $date=$now->modify('+1 day'); setlocale(LC_TIME, 'bg'); echo strftime("%A", date_timestamp_get($date)); ...

Create a variable Date in format “yyyy-mm-dd”

java,sqlite,date,jdbc

You don't need to worry about the format of the date when storing it. The database will simply store the date instance and you can use one of its functions to format it on retrieval. SQL Lite date functions: https://www.sqlite.org/lang_datefunc.html If you don't want to be tied to the functions...

Excel VBA InputBox value is not a date

excel,vba,excel-vba,date,user-input

Prefix the value with a single apostrophe and Excel will interpret it as a string. Eg '18/19/4561 Also, have you tried setting the cell format to Text...

Construct date for specific day of current month and convert it to epoch

date,converter,epoch

Try backqoutes approach date -d "`date +\"%Y-%m-04 00:00:00\"`" +%s ...

PHP Date Comparison Not Working

php,date

The date format you used should be 'mm/dd/yyyy', not 'dd/mm/yyyy'.

What are valid input DATE formats for the (Linux) date command?

linux,bash,date,scripting

A workaround: x="2015_06_15" date -d "${x//_/} 12:00 +1 day" +%Y%m%d Output: 20150616 ...

How can I convert a date string from Mongoose Query?

javascript,date,mongoose

If you want parse the mongodb result, use moment.js to convert String to date : http://momentjs.com/. var date = moment("24th June 2015", "Do MMM YYYY"); // you've got a moment Date If you want convert this MongoDb String to date for queries, convert a date with monent.js to this String...

Using date in CreateQueryDef

vba,date,ms-access

Dates in Access needs to be surrounded by the # tags so that it recognizes the date you have passed. The other important factor to consider is that JET requires the date format to be mm/dd/yyyy as opposed to the normal dd/mm/yyyy. So your problem is because you are using...

Using VLOOKUP formula or other function to compare two columns

mysql,excel,vba,date

If data in your first table starts at A2, and your other column starts at D2, then use in E2 =VLOOKUP(D2,$A$2:$B$17,2,0) Copy down as needed....

java.text.ParseException: Unparseable date: “01-02-2014”

java,date

Your format is dd/MM/yyyy but date is 01-02-2014. Make date format matching expected input. Like this: DateFormat sdf = new SimpleDateFormat("dd-MM-yyyy",Locale.ENGLISH); ...

PHP Checking if user is online

php,date,datetime,timestamp

I have to admit the date/time functions in PHP are a bit cumbersome. That is the reason I always work with the Carbon toolbox when working with dates and times. And if you are using composer, including it is as easy as typing composer require nesbot/carbon in your console. It...

Remove leading zeros from Oracle date

sql,oracle,date

You can use fm before MM. Query SELECT TO_CHAR (SYSDATE, 'DD-fmMM-YYYY') AS today FROM dual; Output 17-6-2015 http://docs.oracle.com/cd/B28359_01/server.111/b28286/sql_elements004.htm#SQLRF00216 Add: To have all leading zero's removed: SELECT TO_CHAR (TO_DATE('01-01-2015', 'DD-MM-YYYY'), 'fmDD-MM-YYYY') AS today FROM dual; 1-1-2015 To remove leading zero from month number: SELECT TO_CHAR (TO_DATE('01-01-2015', 'DD-MM-YYYY'), 'DD-fmMM-YYYY') AS today FROM...

How to change format of date and insert it in database using php and html only

php,html,mysql,date

Thanks for help but I found the solution. We can simply enter the date by accepting input type='text' through HTML and store it directly in database and we can use this code while displaying data from database :- $date = date('d-m-Y', strtotime($_POST["date"])); Now we can see data in dd-mm-yy format...

disable past dates and to-date duration to three month

javascript,angularjs,twitter-bootstrap,date,bootstrap-datetimepicker

There is a 'before-render' callback that will execute on every render of the datepicker, giving you a range of DateObjects appearing the current view. One of the properties of the DateObject is selectable. Setting that controls if the date can be chosen. For your scenario it is very easy to...

Date incrementing issue in bootstrap date picker

javascript,angularjs,date,datepicker,bootstrap-datepicker

As explained in toISOString() documentation, this function returns the date (timestamp) in the zero UTC offset. The timestamp you are providing is in the "India Standard" time zone. So that those two dates are representing the same exact moment, but one is showing the time at the Greendwich meridian and...

Convert long int seconds to double precision floating-point value

c++,date,datetime,time,converter

There are 86400 seconds in a day, and 25569 days between these epochs. So the answer is: double DelphiDateTime = (UnixTime / 86400.0) + 25569; You really do need to store the Unix time in an integer variable though. ...

Convert string to ISODate in MongoDB

javascript,python,mongodb,date

If you can be assured of the format of the input date string AND you are just trying to get a count of unique YYYYMMDD, then just $project the substring and group on it: var data = [ { "name": "buzz", "d1": "2015-06-16T17:50:30.081Z"}, { "name": "matt", "d1": "2018-06-16T17:50:30.081Z"}, { "name":...

using while loop not looping through date properly [on hold]

sql,sql-server,date

This is what I meant: declare @currentDate datetime,@enddate datetime set @currentDate = '20150601' set @enddate='20150605' while (@currentDate <= @enddate) begin select @currentDate as currentdate select @currentDate = dateadd(DAY,1,@currentDate) end ...

How to find the days b/w two long date values

javascript,jquery,date

First you need to get your timestamps in to Date() objects, which is simple using the constructor. Then you can use the below function to calculate the difference in days: var date1 = new Date(1433097000000); var date2 = new Date(1434479400000); function daydiff(first, second) { return (second - first) / (1000...

How can I delete the '0' from my date day in django (python)?

python,django,date,datetime

You can use dateutil by installing pip install python-dateutil Then >>>from dateutil import parser >>>mydate = "June 3, 2001" >>>str(parser.parse(mydate).date()) '2001-06-03' ...

Python: if date is passed or not logic with strings

python,date

Use the datetime module to work with dates, and strptime to parse strings that represent dates. >>> import datetime >>> cutoff = datetime.datetime.strptime('2015-2-19', '%Y-%m-%d') >>> a = datetime.datetime.strptime('2015-3-20', '%Y-%m-%d') >>> b = datetime.datetime.strptime('2015-1-2', '%Y-%m-%d') >>> c = datetime.datetime.strptime('2015-2-9', '%Y-%m-%d') >>> d = datetime.datetime.strptime('2015-2-09', '%Y-%m-%d') >>> a>=cutoff True >>> b>=cutoff False...

How to Detect that user have selected date from html input date [closed]

php,html,html5,date

Why can't we just use the HTML5 required? <input type="date" name="date" required> ...

Formatting dates in an MVC Dropdown

date,model-view-controller,html-select

Maybe a better way to do this would be to define a property in your model that returns IEnumerable<SelectListItem> (in your model class): public DateTime SelectedDate {get;set;} public IEnumerable<SelectListItem> SeasonDates { get { foreach (var item in seasonDates) yield return new SelectListItem() { Text = item.ToShortDateString(), // or apply your...

JSON Date Formatting

jquery,json,date

You don't really need JQuery for that. Plain javascript works as well: var date = new Date('2009-06-25T17:32:10.0000000'); console.log(date.getDate() + '/' + (date.getMonth() + 1) + '/' + date.getFullYear() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds()); ...

Show current time of most commons timezone (UTC, EDT, CEST…)

linux,bash,date

You can point TZ to the timezone you want: $ TZ=Europe/Paris date Fri Jun 12 07:41:28 CEST 2015 ...

Get a variables value from one dataset if falling in a range defined by two variables in another dataset in R

r,date,statistics,dataset

Here a solution based on the excellent foverlaps of the data.table package. library(data.table) ## coerce characters to dates ( numeric) setDT(x)[,c("date1","date2"):=list(as.Date(date1,"%d/%m/%Y"), as.Date(date2,"%d/%m/%Y"))] ## and a dummy date since foverlaps looks for a start,end columns setDT(y)[,c("date1"):=as.Date(date,"%d/%m/%Y")][,date:=date1] ## y must be keyed setkey(y,id,date,date1) foverlaps(x,y,by.x=c("id","date1","date2"))[, list(id,i.date1,date2,date,price)] id i.date1 date2 date price 1: A...

IBM Cognos _days_between function not working

mysql,database,date,cognos

The Cognos _days_between function works with dates, not with datetimes. Some databases, like Oracle, store all dates with a timestamp. On a query directly to the datasource, try using the database's functions to get this data instead. When possible, this is always preferable as it pushes work to the database,...

SQL stored procedure: increment months from a starting date to an end date

sql-server,tsql,date,stored-procedures,cursor

This can easily be done with a recursive CTE: ;WITH cte AS ( SELECT @Start AS [Month] UNION ALL SELECT DATEADD(MONTH, 1, [Month]) FROM cte WHERE [Month] < @End ) SELECT [Month] FROM cte OPTION (MAXRECURSION 0) ...

reading OData date format in R

r,date,odata

This is the Unix epoch time in milliseconds. x <- "/Date(1391514600000)/" x <- as.numeric(gsub("[^0-9]", "", x)) x # [1] 1391514600000 # from milliseconds to seconds: x <- x / 1000 as.POSIXct(x, origin="1970-01-01", tz="GMT") # [1] "2014-02-04 11:50:00 GMT" ...

convert date format in php [duplicate]

php,mysql,date

echo strftime("%B %m, %Y", strtotime($crs_date1)); Might give you an error (this was just off the top of my head), so the format (first parameter of strftime) could be a bit wrong...

Android - At Minutes to a Time hh.mm.ss

java,android,date,time

First, a 'time' without a date is not valid. Think about daylight saving time etc. One solution is maybe to create two date objects (with a fixed date) and use them for your calculation. Or parse the string and use TimeUnit to work with the values. Keep in mind that...

Excel VBA's Date() function acting up

excel-vba,date

Date is a property and does not accept parameters. You want DateSerial()....