Posts by Jetro Bernardo • 45 points
8 posts
-
-2
votes4
answers18454
viewsA: How to replace a certain string within another string in Javascript?
var linha_nova = "EU TENHO UM CACHORRO"; alert(linha_nova.replace("UM", "CARA DE"));
-
1
votes3
answers1639
viewsA: Date format in an NF-e
To get a date in the format "YYYY-MM-Ddthh:mm:ssTZD" in PHP I do so: <?php echo date("Y-m-d\TH:i:sP"); ?> If you need to use the date from a Variable, it would look like this: $data =…
-
0
votes2
answers98
viewsQ: How to sort array by key and value without losing the original key value?
I’ve tried every way. The pure array is like this: Array ( [71] => 100 [70] => 100 [69] => 23.53 [68] => 74.07 [67] => 23.29 [66] => 61.01 [59] => 100 [3] => 35 [1] =>…
phpasked Jetro Bernardo 45 -
0
votes2
answers55
viewsQ: Why do I get different results for the same values sent to a PHP function?
I need to turn HOUR into DECIMAL and then do the opposite operation. I created the functions as shown below, but the result was not efficient because, depending on the origin of the value, the…
phpasked Jetro Bernardo 45 -
1
votes2
answers1168
viewsA: Function to calculate the Checker Digit of an EAN-13 code
<?php function digito($cod) { $cnt=1; $arr = str_split($cod); foreach($arr as $k => $v){ if($cnt % 2 == 0) { $par = ($par+$v); }else{ $impar = ($impar+$v); } $cnt++; } $par =…
-
1
votes2
answers1168
viewsQ: Function to calculate the Checker Digit of an EAN-13 code
EAN-13 is a barcode in the EAN standard defined by GS1, adapted in more than one hundred GS1 member organizations, for the identification of items, mainly at retail or retail outlets around the…
-
0
votes2
answers213
viewsA: Add days to a date within the method and return it with new period
Here’s a role I use in JAVASCRIPT... function somaDias(dt,qtd) { var dt1 = dt.split("/"); var hj1 = dt1[2]+"-"+dt1[1]+"-"+dt1[0]; var dtat = new Date(hj1); dtat.setDate(dtat.getDate()); var myDate =…
javascriptanswered Jetro Bernardo 45 -
0
votes2
answers1779
viewsA: How to add date, from a Date and Number of days typed by the user
Here’s a role I use in JAVASCRIPT... function somaDias(dt,qtd) { var dt1 = dt.split("/"); var hj1 = dt1[2]+"-"+dt1[1]+"-"+dt1[0]; var dtat = new Date(hj1); dtat.setDate(dtat.getDate()); var myDate =…
javascriptanswered Jetro Bernardo 45