w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Contradicting issue of Weekday between PHP Date and Online Date
If you're talking about the Gregorian calendar, your online checker is correct - it's Friday, and I don't understand the PHP output. It may be that it's interpreting it as a Julian date, but that would also be incorrect. I suspect you do mean the Gregorian calendar, as July 19th 622 (Gregorian) is the civil epoch for the Islamic calendar. This is equal to July 16th 622 (Julian) which is the more common way of referring to the date. From the Wikipedia article on the Islamic Calendar: The first day of the first month of the Islamic calendar (1 Muharram 1 AH) was Friday, 16 July AD 622, the equivalent civil tabular date (same daylight period) in the Julian calendar.[22][23] The Islamic day began at the preceding sunset on the evening of 15 July. (The part about days starting at sunset

Categories : PHP

Date format issue : Convert from String to Date
I found the answer. DateFormat readFormat = new SimpleDateFormat("E MMM dd HH:mm:ss Z yyyy"); date = readFormat.parse(string); And then while saving to MYSQL database... pstmt.setDate(5, new java.sql.Date(change.getEndDateTime().getTime())); Thanks for all your responses and apologies for posting duplicate if it is... Regards, SG

Categories : Java

Converting any date to local date issue
NSDate represents the time since Jan 1st 1970 in UTC. Never try to pretend it is anything else. Never try to think of an NSDate as being in a particular local time. So what you need is a date from a calendar + an offset which represents the time since midnight today. To get today 0:00am UTC, you first need a Gregorian calendar for the UTC time zone. NSTimeZone* utcTimeZone = [NSTimeZone timeZoneWithName:@"UTC"]; NSCalendar* gregorian = [[NSCalendar alloc] initWithCalendarIdentifier: NSGregorianCalendar]; [gregorian setTimeZone: utcTimeZone]; Now you use date components to get the hours, minutes and seconds since midnight UTC NSUInteger unitFlags = NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit; NSDate *date = [NSDate date]; NSDateComponents *comps = [gregorian c

Categories : Objective C

SQL date issue when date is not isdate
I assume you want to exclude future dates from your select, so you can use something like this. (also, please specify RDBMS because the GETDATE() function might not be available in the one you're using) SELECT Expiry, DateEnd FROM YOUR_TABLE WHERE Expiry <> 'none' AND convert(INT, substring(expiry, charindex(' ', expiry, 0), len(expiry))) < YEAR(GETDATE()) AND CASE LOWER(substring(expiry, 0, charindex(' ', expiry, 0))) WHEN 'january' THEN 1 WHEN 'february' THEN 2 WHEN 'march' THEN 3 WHEN 'april' THEN 4 WHEN 'may' THEN 5 WHEN 'june' THEN 6 WHEN 'july' THEN 7 WHEN 'august' THEN 8 WHEN 'september' THEN 9 WHEN 'october' THEN 10 WHEN 'november' THEN 11

Categories : SQL

2 variables in a function getting the same date value
You might think that these two lines copy dateInput into prevWeek and prevMonth: var prevWeek = dateInput; var prevMonth = dateInput; Not so. They make prevWeek and prevMonth point to the same place. When you then call methods on them: prevWeek.setDate(prevWeek.getDate()-7); prevMonth.setDate(prevMonth.getDate()-30); You're just changing the object they're pointing to; it's equivalent to dateInput.setDate(dateInput.getDate()-7); dateInput.setDate(dateInput.getDate()-30); Probably not what you wanted. To actually copy the date, use new Date, passing it the date you want to copy: var prevWeek = new Date(dateInput); var prevMonth = new Date(dateInput); This makes them each point to a new, non-identical Date representing the same moment in time.

Categories : Javascript

How to compare two date variables in XSLT?
You're missing some dollar signs - it should be <xsl:when test='$OrderCreateDate != $OrderEditDate'> Your current test is trying to find elements called OrderCreateDate and OrderEditDate as children of the current context node, which I presume (given your variable definitions) don't exist. Thus it's checking whether '' != '', and taking the otherwise branch.

Categories : Xml

Create mysql compatible Date from variables in PHP
The least ambiguous form is probably 2013-08-07 ... but other forms are possible. Consult the MySQL manual.

Categories : PHP

Split HTML 5 date input value into three variables
This seems to work without jQuery on Chrome when I run it local or on my web server but when I try it on fiddle it fails: function PassTheMic(){ document.getElementById('myField1').value = document.getElementById('myFieldx').value; } </script> <form method="post" action="mailto:me@me.com"> <input type="date" id="myFieldx" value="" name="myFieldx" onBlur="PassTheMic()" min="2012-01-01" max="2013-01-01"/> <input type="hidden" id="myField1" value="" name="myField1" /> <input type="submit" value="submit" name="submit"> </form>

Categories : Jquery

Two @media variables, issue
Try setting the max-width also for your first condition, as currently both your "min-widths" will be hit when the resolution is > 1610px. @media only screen and (max-width: 1609px) and (min-width: 1290px){ }

Categories : CSS

Adding date and time variables and getting unix timestamp
If you run this code: date_default_timezone_set('CST6CDT'); $dt = strtotime('09/04/2013 7:25'); echo $dt . " - " . gmdate('r', $dt); You will get: 1378279500 - Wed, 04 Sep 2013 12:25:00 +0000 If you're getting your date & time in GMT then set timezone accordingly before calling strtotime like this: date_default_timezone_set('GMT');

Categories : PHP

Subtract two date variables and get in terms of days in javascript
The long integer is the number of milliseconds since midnight Jan 1, 1970. So in order to get the number of days you need to divide it. Code below: var days = day/(1000*60*60*24);

Categories : Javascript

Issue with dynamically created variables
Try this: AvGen = { currSvg: 0, svg: [], init: function() { AvGen.loadSVG(); AvGen.toolBox(); }, loadSVG: function() { AvGen.svg.push([0,0,255.3,298.5,{type:'path',path:'M 35.3 257.2 C 34.4 245.7 45.4 234.1 48.5 223 C 53.6 204.3 55 185 60 166.2 C 69.5 131 69.6 97.1 89.1 65.1 C 103.4 41.7 129.5 5.3 161.3 19.7 C 184.6 30.3 181.3 59.2 188.9 78.9 C 207.5 127.3 228.6 184.8 230.3 237.3 C 231.3 268.6 202.8 261.3 178.2 264 C 149.2 267.1 120 269.6 91 272.2 C 84.2 272.8 75.8 274.2 69 273 C 60.9 271.6 28.9 259.9 31.3 249.2','fill':'#39b54a','stroke':'none','stroke-width':'0','fill-opacity':'1','stroke-opacity':'0'}]); AvGen.svg.push([0,0,278.9,314.1,{type:'path',path:'M 32 265 C 31.8 245.2 38 226.9 39.8 207.3 C 41.9 184.4 42 161.7 42 138.7 C 42

Categories : Jquery

Issue deleting session variables
Try this: $_SESSION['cart_array'] = Array();//This should empty the cart. Then test only for empty. The reason is most likely due to the way PHP's GC works. Read this answer for better explanation.

Categories : PHP

Issue with Outputing Variables in Java
else System.out.println (num1); System.out.println (num2); needs an opening brace: else { System.out.println (num1); System.out.println (num2); } The code overall(since you're losing your braces everywhere) should read: import java.util.*; public class HigherNumber{ public static void main (String[] args){ int num1 = 0; int num2 = 0; Scanner scannum1 = new Scanner (System.in); Scanner scannum2 = new Scanner (System.in); System.out.print("Enter your first number: "); num1 = scannum1.nextInt(); scannum1.close(); System.out.print("Enter your second number: "); num2 = scannum2.nextInt(); scannum2.close(); if (num1 > num2) { System.out.println (num2); Sys

Categories : Java

Weird issue with concatenate variables
To see if your string is not null you should use var_dump() or print_r() functions. Example: $this->tableData = '<table>'; echo "Dumping tableData: " . var_dump($this->tableData); $this->tableData .= $string; echo "Dumping tableData 2: " . var_dump($this->tableData); echo "Dumping string: " . var_dump($string); That way you will see exactly what is going on.

Categories : PHP

Is there Standard Syntax for date/time addition/subtraction and variables?
For the first part of your question, no there isn't a standard for tokens like "now", "today", "yesterday", or "first of current month", etc. At least not that I am aware of. For the second part, yes, there is a standard for tokens that define durations of time in discrete segments. This is the second (often overlooked) part of ISO8601. You can read about it here. For example, P3Y6M4DT12H30M5S represents a duration of "three years, six months, four days, twelve hours, thirty minutes, and five seconds". Noda Time is one library in .Net that has support for ISO8601 durations (called a Period in Noda Time). You can use NodaTime.Text.PeriodPattern to work with them. Noda Time might be a good basis for the rest of your concerns as well. The text pieces are extensible, so perhaps you cou

Categories : Dotnet

GET variables not received from PHP redirect, is it a rewrite issue?
Even though you've declared a RewriteBase, you can't exclude it from the pattern matching side of the Rules. A lot of the online testers don't support things like RewriteBase. Try this and see if it works. RewriteEngine On RewriteBase /simple_blog/ RewriteRule .(gif|jpg|png|css|js|inc.php)$ - [L] RewriteRule ^simple_blog/admin/([w-]+)/?$ admin.php?page=$1 [NC,L] RewriteRule ^simple_blog/admin/([w-]+)/([w-]+) admin.php?page=$1&url=$2 [NC,L] RewriteRule ^simple_blog/([w-]+)/([w-]+) index.php?page=$1&url=$2 [L] RewriteRule ^simple_blog/([w-]+)/?$ index.php?page=$1 [L]

Categories : PHP

Issue with Heroku, configuration variables and django using S3
I'm not familiar with python or Django, but I'm curious. If you try your authentication with blank strings, do you get the same error? If so, then I suspect it's about when you're doing this authentication dance. When are you doing it? At compile time, or at runtime? (If at compile time, look at this)

Categories : Django

SQLCMD variables and SSDT schema compare issue
You can work around this by schema comparing your development database, rather than the project, to the live database. Keep in mind that you would have to deploy the project to your development database first.

Categories : Sql Server

createQueryBuilder()->where() issue. bound variables and tokens do not match
binding your query parameters using setParameter() is the key to success here ... read more about it here. public function getGroupByName($name) { return $this->createQueryBuilder('g') ->where('g.name = :name') ->setParameter('name', $name) ->getQuery() ->getSingleResult(); }

Categories : PHP

logic issue with spitting out data, variables being repeated
I see no errors here try this .. if it does not work past part of the json. var json = JSON.parse(xmlHTTP.responseText), message = "<table><tr id='head_table'><td>Name:</td><td>Rnd 1:</td><td>Rnd 2:</td><td>Rnd 3:</td><td>Rnd 4:</td><td>Rnd 5:</td><td>Rnd 6:</td><td>Options:</td></tr>"; for(var i=0; i<json.collection.length; i++){ message+="<tr><td>" + json.collection[i].customer.name + "</td>"; for(var j=0; j<json.collection[i].events.length; j++){ message+="<td>" + json.collection[i].events[j].time_stamp + "</td>"; } message+="</tr>"; } message+="</table>"; you don't need to write msg=msg+evntmsg it's confusing and lea

Categories : Javascript

Issue with Oracle bind variables not using index properly
Just a quick question: I guess the following non-parameterized query will also run for 1.5 minutes? select * from Purchases where (1700656396 IS NULL OR purchase_id = 1700656396) and ('some-name' IS NULL OR purchase_name = 'some-name') and (12 IS NULL OR purchase_price = 12) If yes, the problem is not the bind variables but the lack of indexes. EDIT The problem is, Oracle cannot decide to use the index when generating the plan for the parametrized query

Categories : Oracle

I've created a GUI calculator using java and it appears the variables aren't staying up to date and just remain at 0
There are a couple of issues I see, but the first thing you'll need to help you along: Where you are performing the equals operation? Doing a simple arithmetic function: A op B = ? (where A and B are numbers and op is one of +, -, *, /) will slot a number into num1, but will not perform the op operation because count will never equal 1. To help yourself out, add the following after the last else if block: System.out.println("num1: " + num1 + " num2: " + num2 + " num3: " + num3 + " display: " + display.getText() + " fakedisplay: " + fakedisplay.getText() + " response: " + response + " count: " + count + " total: " + total); This will give you a hint as to what has just happened after you hit each key/button. If you think about the logic steps, what you need to do is: C

Categories : Java

MVC 4 date culture issue?
Try adding this attribute to your MyDate property: [DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}", ApplyFormatInEditMode = true)] Though setting the culture in the web.config should do it, this should force it into that format. UPDATE Ok, so the above answer doesn't really solve the issue, though it is important if you do want to change the format of how the date is initially displayed. An important note is that the DisplayFormat attribute is not picked up by the TextBoxFor helper but it is by the EditorFor helper. Anyway, on to the real solution. The problem is the jQuery validation not accounting for the culture when parsing a date. If you turn off the client side validation the date is parsed just fine on the server that is aware of the culture. The fix is to override the

Categories : Asp Net Mvc

Date output issue
The problem is that you don't return a new Date instance but change the provided one. You always modify and print the same instance. Change your function to public static Date addDays(Date d, int days) { return new Date(d.getTime() + days * 1000 * 60 * 60 * 24); }

Categories : Java

ISO date convert issue
I not really sure about this, but if you want the output like that, i try to change the code like this. new Date('Sun Jun 30 2013 00:00:00 GMT+0530 (India Standard Time) UTC') toISOString

Categories : Javascript

Sort by date issue
Change the loops to be like the following: for (i = (Piece - 1); i > 0; i--) { for (j = 1; j <= i; j++) { // compare and swap } } Source: http://www.algorithmist.com/index.php/Bubble_sort.c

Categories : C

Date picker issue
I assume you are using the wrong format for the default date, it needs to be an integer YYYYMMDD. Have you tried using the min: 20130625 variable in stead of an adjusted default date?

Categories : PHP

Werid MVC Date Issue
By design the HiddenFor helper (which eventually gets used by the EditorFor) always uses the current culture format when rendering its value. If you want to override this behavior you could write a custom editor template (~/Views/Shared/EditorTemplates/HiddenInput.cshtml): @if (!ViewData.ModelMetadata.HideSurroundingHtml) { @ViewData.TemplateInfo.FormattedModelValue } @Html.Hidden("", ViewData.TemplateInfo.FormattedModelValue) and then you will be able to specify the format using the DisplayFormat attribute and override the current culture's format: [HiddenInput(DisplayValue = false)] [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd/MM/yyyy}")] public DateTime ProposedDateTime { get; set; }

Categories : Asp Net Mvc

PHP Excel Date Issue
try this $fDate = $importData[1][C]; $fDate='10-29-14'; $fDate= explode('-', $fDate); $fDate=$fDate[1].'-'.$fDate[0].'-'.str_pad('14', 4, '20',STR_PAD_LEFT); echo $fDate;// 29-10-2014

Categories : PHP

php session variables being echoed in title but not in og meta. Timing issue?
How are you setting your $_SESSION["clientName"]? Facebook scrapes your link and cache meta data of your link. I guess facebook is not able to set your session data $_SESSION['clientName']. Are you setting that session data according to user login or something that user action have chosen? If that is case facebook will not be able to set that for you. you can try this while generating sharing link: your clientName sharing link can be this http://yoursite.com/?clientName=<?php echo $_SESSION['clientName'];?> and in your site you can do: <meta property="og:description" content="<?php echo $_GET["clientName"]; ?>"/> Add validations on $_GET["clientName"] as required.

Categories : PHP

Date format handsontable issue
Try setting the date format: $("#old_tab_handsontable").handsontable({ data: data, startRows: 1, colHeaders: ['ID', 'datePers', 'dateArchive', 'dateAncienne', 'dateDef', 'IS'], columns: [ {data: 'ID'}, {data: 'datePers', type: 'date', dateFormat: 'mm/dd/yy'}, {data: 'dateArchive', type: 'date', dateFormat: 'mm/dd/yy'}, {data: 'dateHist.old', type: 'date', dateFormat: 'mm/dd/yy'}, {data: 'dateDef', type: 'date', dateFormat: 'mm/dd/yy'}, {data: 'IS'} ], colWidths: [100, 100, 100, 100, 100, 100] });

Categories : PHP

timezone issue with javascript date
MomentJS is parsing the date as a locale date-time. If no hour is given, it is assuming midnight. Then, you convert it to UTC, so it is shifted, according to your local time, forward or backwards. If your are in UTC+N, then you will get the previous date. Check this formats moment(new Date('07-18-2013')).utc().format("YYYY-MM-DD HH:mm").toString() "2013-07-17 21:00" moment(new Date('07-18-2013 12:00')).utc().format("YYYY-MM-DD HH:mm").toString() "2013-07-18 09:00" Date() "Thu Jul 25 2013 14:28:45 GMT+0300 (Jerusalem Daylight Time)" moment(new Date('07-18-2013 UTC')).utc().format("YYYY-MM-DD HH:mm").toString() "2013-07-18 00:00" // always "2013-05-23 00:55" moment(1369266934311).zone('+0100').format('YYYY-MM-DD HH:mm') Refer to this documentation. Update : moment().format("dddd

Categories : Javascript

CFSpreadsheet Date formatting issue
If you ever figure it out, please let me know. Here's a link to the sample code I've been made available back in 2011. It doesn't work with ColdFusion 9 or 10. I've also listed all of the official "built-in" (but not supported) date formats. http://pastebin.com/aQnembR3 <cfset q = queryNew("Name,Date", "varchar,date")> <cfloop index="x" from="1" to="10"> <cfset queryAddRow(q)> <cfset querySetCell(q, "Name", "Name #x#")> <cfset querySetCell(q, "Date", now())> </cfloop> <cfset dfStyle = {dataformat = "m/d/yy h:mm"}> <cfset o = spreadsheetNew('dateTest', true)> <cfset spreadsheetAddRows(o, q)> <cfset spreadsheetFormatColumn(o, dfStyle, 2)> <cfset bin = spreadsheetReadBinary(o)> <cfheader name="Content-Di

Categories : Excel

List.js - By date sorting issue
I know this is an old question, but this answer might help new comers. Associate your date field with Timestamps and then compare/sort Timestamps. It's up to you, but one suggestion would be to add it as a second hidden field in same level where you display each of your dates, then when u sort, the whole div/tr will be effected. Here's an example of what I used: My list is working as a table, and here the <td> is the container, c_start is the actual date being displayed, i show it as i want (dd/mm/yyyy, dd-mm-yy) because it's only a display. As for the sorting, i use c_start_ts and have it hidden. in c_start_ts I put the timestamp value, it's a perfect sort. Even if you later want to apply filtering, it will be easier to handle timestamps since it can be converted to a real in

Categories : Javascript

Django date format issue
Try this, def calender(request): """""" settingsform = SettingsForm(instance=settings) if settings and settings.date_format: date_format = reportform.fields['manual_date'].input_formats[1] createddate = report.created_date_time.strftime('%b %d %Y') else: date_format = reportform.fields['manual_date'].input_formats[0] createddate = report.created_date_time.strftime('%d %b %Y') date = report.manual_date.strftime(date_format) if request.method == 'POST': reportform = ReportDateTimeForm(request.POST, instance=report,date_format=date_format) if reportform.is_valid(): report = reportform.save(commit=False) report.user = request.user report.save() """""" return render_to_response('calender.html', {

Categories : Django

Issue with Javascript Date format
I think 14th is your problem http://jsfiddle.net/blackjim/FUDf7/3/ var day= "Sunday, February 14 2010, 3:25:50 pm"; var valid=moment(day,"dddd MMMM D YYYY h:mm:ss a").isValid(); alert(valid);

Categories : Javascript

Java Date Format Issue
You are using int literals instead of long in your numbers. By default a integral literal is int unless you specify that is long with L at the end. Try this: Date d1 = new Date(1000*1373604190L); (note the L at the end of your literal 1373604190)

Categories : Java

Java Date Math Issue
What is the meaning of the Date fields in your job object? I get the feeling you're trying to represent a "time of day" with a date object. This is probably not a good idea. If you want a job to run 6 hours into the day, I would store a long that represents 6 hours in millis: static final long ONE_HOUR = 1000L * 60L * 60L; Date today = DateUtil.getToday(); Date todayExecTime = new Date(today.getTime() + 6 * ONE_HOUR); Of course, if your locale uses daylight saving time, this method could be off by an hour twice per year (if your exec time is after the change in time, which is usually early in the morning). If you just want JobA to run 6 hours into the day (rather than running at 6:00AM) it won't matter. If this is a small piece of a more complicated scheduling system, you mig

Categories : Java

Issue in Sorting date in gridview
var temp = table.AsEnumerable() .OrderBy(x => x.Field<string>("LossDate") !=null) .ThenByDescending(p => !DateTime.TryParse(p.Field<string>("LossDate"), out dt)) .ThenBy(x => x.Field<string>("LossDate")); var result =temp.AsDataView().ToTable(); and set above as DataSource of girdview Sample : DataTable table = new DataTable(); table.Columns.Add("LossDate", typeof(string)); table.Rows.Add(new DateTime(2004, 05, 27)); table.Rows.Add(DBNull.Value); table.Rows.Add("A90317"); table.Rows.Add(new DateTime(2009, 06, 27)); table.Rows.Add("A90118"); table.Rows.Add(DBNull.Value); table.Rows.Add("A00921"); table.Rows.Add(DBNull.Value); table.Rows.Add(new DateTime(2005, 06, 27)); DateTime dt; var temp = table.AsEnumerable() .OrderBy(x => x.Field<string&g

Categories : C#



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