how to Replace date with mysql query












0















I need a MySQL request to replace the DATE data type. But when I use where this query doesn't work. What is not right in this query?



UPDATE absensi2 
SET tgl_masuk = replace(tgl_masuk, '2019-01-02', '2019-01-03'),
state='Update' WHERE tgl_masuk='2019-01-02' && state='NULL'


Thank's










share|improve this question

























  • Is $awal in the query been replaced by the value hold by the variable $awal?

    – Yves Kipondo
    Dec 29 '18 at 6:40











  • Hi @YvesKipondo, yes I have replaced the varible. <pre>UPDATE absensi2 SET tgl_masuk = replace(tgl_masuk, '2019-01-02', '2019-01-03'), state='Update' WHERE tgl_masuk='2019-01-02' && state='NULL'</pre> like that query

    – Dimas Anugerah
    Dec 29 '18 at 6:45











  • Why didn't you replace diirectly the value of tgl_masuk by Setting it value to the date which you provide but you past trough the replace function. Like I can see the value of the row store in the DB attat column precisely hold "2019-01-02"

    – Yves Kipondo
    Dec 29 '18 at 6:51






  • 2





    You can just do UPDATE absensi2 SET tgl_masuk='$akhir' WHERE tgl_masuk='$awal'. you don't have to use replace because you change completly th value of that column and not replace some part of that field

    – Yves Kipondo
    Dec 29 '18 at 6:58






  • 1





    Sure you have a char literal state='NULL' in that table? Why don't you just post the exact error message?

    – digijay
    Dec 29 '18 at 7:04


















0















I need a MySQL request to replace the DATE data type. But when I use where this query doesn't work. What is not right in this query?



UPDATE absensi2 
SET tgl_masuk = replace(tgl_masuk, '2019-01-02', '2019-01-03'),
state='Update' WHERE tgl_masuk='2019-01-02' && state='NULL'


Thank's










share|improve this question

























  • Is $awal in the query been replaced by the value hold by the variable $awal?

    – Yves Kipondo
    Dec 29 '18 at 6:40











  • Hi @YvesKipondo, yes I have replaced the varible. <pre>UPDATE absensi2 SET tgl_masuk = replace(tgl_masuk, '2019-01-02', '2019-01-03'), state='Update' WHERE tgl_masuk='2019-01-02' && state='NULL'</pre> like that query

    – Dimas Anugerah
    Dec 29 '18 at 6:45











  • Why didn't you replace diirectly the value of tgl_masuk by Setting it value to the date which you provide but you past trough the replace function. Like I can see the value of the row store in the DB attat column precisely hold "2019-01-02"

    – Yves Kipondo
    Dec 29 '18 at 6:51






  • 2





    You can just do UPDATE absensi2 SET tgl_masuk='$akhir' WHERE tgl_masuk='$awal'. you don't have to use replace because you change completly th value of that column and not replace some part of that field

    – Yves Kipondo
    Dec 29 '18 at 6:58






  • 1





    Sure you have a char literal state='NULL' in that table? Why don't you just post the exact error message?

    – digijay
    Dec 29 '18 at 7:04
















0












0








0








I need a MySQL request to replace the DATE data type. But when I use where this query doesn't work. What is not right in this query?



UPDATE absensi2 
SET tgl_masuk = replace(tgl_masuk, '2019-01-02', '2019-01-03'),
state='Update' WHERE tgl_masuk='2019-01-02' && state='NULL'


Thank's










share|improve this question
















I need a MySQL request to replace the DATE data type. But when I use where this query doesn't work. What is not right in this query?



UPDATE absensi2 
SET tgl_masuk = replace(tgl_masuk, '2019-01-02', '2019-01-03'),
state='Update' WHERE tgl_masuk='2019-01-02' && state='NULL'


Thank's







mysql date replace






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 29 '18 at 23:21









Simonare

8,41511537




8,41511537










asked Dec 29 '18 at 6:30









Dimas AnugerahDimas Anugerah

318




318













  • Is $awal in the query been replaced by the value hold by the variable $awal?

    – Yves Kipondo
    Dec 29 '18 at 6:40











  • Hi @YvesKipondo, yes I have replaced the varible. <pre>UPDATE absensi2 SET tgl_masuk = replace(tgl_masuk, '2019-01-02', '2019-01-03'), state='Update' WHERE tgl_masuk='2019-01-02' && state='NULL'</pre> like that query

    – Dimas Anugerah
    Dec 29 '18 at 6:45











  • Why didn't you replace diirectly the value of tgl_masuk by Setting it value to the date which you provide but you past trough the replace function. Like I can see the value of the row store in the DB attat column precisely hold "2019-01-02"

    – Yves Kipondo
    Dec 29 '18 at 6:51






  • 2





    You can just do UPDATE absensi2 SET tgl_masuk='$akhir' WHERE tgl_masuk='$awal'. you don't have to use replace because you change completly th value of that column and not replace some part of that field

    – Yves Kipondo
    Dec 29 '18 at 6:58






  • 1





    Sure you have a char literal state='NULL' in that table? Why don't you just post the exact error message?

    – digijay
    Dec 29 '18 at 7:04





















  • Is $awal in the query been replaced by the value hold by the variable $awal?

    – Yves Kipondo
    Dec 29 '18 at 6:40











  • Hi @YvesKipondo, yes I have replaced the varible. <pre>UPDATE absensi2 SET tgl_masuk = replace(tgl_masuk, '2019-01-02', '2019-01-03'), state='Update' WHERE tgl_masuk='2019-01-02' && state='NULL'</pre> like that query

    – Dimas Anugerah
    Dec 29 '18 at 6:45











  • Why didn't you replace diirectly the value of tgl_masuk by Setting it value to the date which you provide but you past trough the replace function. Like I can see the value of the row store in the DB attat column precisely hold "2019-01-02"

    – Yves Kipondo
    Dec 29 '18 at 6:51






  • 2





    You can just do UPDATE absensi2 SET tgl_masuk='$akhir' WHERE tgl_masuk='$awal'. you don't have to use replace because you change completly th value of that column and not replace some part of that field

    – Yves Kipondo
    Dec 29 '18 at 6:58






  • 1





    Sure you have a char literal state='NULL' in that table? Why don't you just post the exact error message?

    – digijay
    Dec 29 '18 at 7:04



















Is $awal in the query been replaced by the value hold by the variable $awal?

– Yves Kipondo
Dec 29 '18 at 6:40





Is $awal in the query been replaced by the value hold by the variable $awal?

– Yves Kipondo
Dec 29 '18 at 6:40













Hi @YvesKipondo, yes I have replaced the varible. <pre>UPDATE absensi2 SET tgl_masuk = replace(tgl_masuk, '2019-01-02', '2019-01-03'), state='Update' WHERE tgl_masuk='2019-01-02' && state='NULL'</pre> like that query

– Dimas Anugerah
Dec 29 '18 at 6:45





Hi @YvesKipondo, yes I have replaced the varible. <pre>UPDATE absensi2 SET tgl_masuk = replace(tgl_masuk, '2019-01-02', '2019-01-03'), state='Update' WHERE tgl_masuk='2019-01-02' && state='NULL'</pre> like that query

– Dimas Anugerah
Dec 29 '18 at 6:45













Why didn't you replace diirectly the value of tgl_masuk by Setting it value to the date which you provide but you past trough the replace function. Like I can see the value of the row store in the DB attat column precisely hold "2019-01-02"

– Yves Kipondo
Dec 29 '18 at 6:51





Why didn't you replace diirectly the value of tgl_masuk by Setting it value to the date which you provide but you past trough the replace function. Like I can see the value of the row store in the DB attat column precisely hold "2019-01-02"

– Yves Kipondo
Dec 29 '18 at 6:51




2




2





You can just do UPDATE absensi2 SET tgl_masuk='$akhir' WHERE tgl_masuk='$awal'. you don't have to use replace because you change completly th value of that column and not replace some part of that field

– Yves Kipondo
Dec 29 '18 at 6:58





You can just do UPDATE absensi2 SET tgl_masuk='$akhir' WHERE tgl_masuk='$awal'. you don't have to use replace because you change completly th value of that column and not replace some part of that field

– Yves Kipondo
Dec 29 '18 at 6:58




1




1





Sure you have a char literal state='NULL' in that table? Why don't you just post the exact error message?

– digijay
Dec 29 '18 at 7:04







Sure you have a char literal state='NULL' in that table? Why don't you just post the exact error message?

– digijay
Dec 29 '18 at 7:04














0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53967263%2fhow-to-replace-date-with-mysql-query%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53967263%2fhow-to-replace-date-with-mysql-query%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Monofisismo

Angular Downloading a file using contenturl with Basic Authentication

Olmecas