DatePeriod not setting the timezone [duplicate]





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







2
















This question already has an answer here:




  • PHP strftime outputs wrong format despite correct timezone

    3 answers




I am creating a DatePeriod and I want to show the names of months and days in French:



$timeZoneParis = new DateTimeZone('Europe/Paris');
$dateDebutCalendrier = new DateTime('2018-11-01', $timeZoneParis);
$dateFinCalendrier = new DateTime('2018-11-31', $timeZoneParis);
$period = new DatePeriod($dateDebutCalendrier,new DateInterval('P1D'),$dateFinCalendrier);


Expected result:




Janvier, Fevrier...




Actual result:




January, February...











share|improve this question















marked as duplicate by Matt Johnson date
Users with the  date badge can single-handedly close date questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 26 '18 at 22:21


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.



















  • I'm not sure what you mean by "the good time zone"? Can you edit your question to clarify 1. what result you are getting and 2. what result you expect? You're not passing a DateTimeZone to $lastDayThisMonth - is this intentional, or an omission?

    – Darragh Enright
    Nov 23 '18 at 11:23













  • @DarraghEnright not intentional, i've changed my code to a better format and updated my question :)

    – Projet Sin
    Nov 23 '18 at 11:29











  • I understand now. This is not something you can configure or control directly using DateTime and DatePeriod - this is a locale based question, and DateTime does not honour locales. You have a few choices, including IntlDateFormatter if you have it installed, or strftime(). Here are some helpful answers

    – Darragh Enright
    Nov 23 '18 at 11:43











  • I tried this : echo strftime("%d %B", $dateDebutCalendrier->getTimestamp()); but this is still in English

    – Projet Sin
    Nov 23 '18 at 13:05











  • @ProjetSin - Check out the dup question, which bears an uncanny resemblance to yours, asked one week earlier. Are you and that author (kalvn) associated in some way? This seems like another case of StackOverflow déjà-vu... Can you shed some light on this phenomenon? Thanks.

    – Matt Johnson
    Nov 26 '18 at 22:25


















2
















This question already has an answer here:




  • PHP strftime outputs wrong format despite correct timezone

    3 answers




I am creating a DatePeriod and I want to show the names of months and days in French:



$timeZoneParis = new DateTimeZone('Europe/Paris');
$dateDebutCalendrier = new DateTime('2018-11-01', $timeZoneParis);
$dateFinCalendrier = new DateTime('2018-11-31', $timeZoneParis);
$period = new DatePeriod($dateDebutCalendrier,new DateInterval('P1D'),$dateFinCalendrier);


Expected result:




Janvier, Fevrier...




Actual result:




January, February...











share|improve this question















marked as duplicate by Matt Johnson date
Users with the  date badge can single-handedly close date questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 26 '18 at 22:21


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.



















  • I'm not sure what you mean by "the good time zone"? Can you edit your question to clarify 1. what result you are getting and 2. what result you expect? You're not passing a DateTimeZone to $lastDayThisMonth - is this intentional, or an omission?

    – Darragh Enright
    Nov 23 '18 at 11:23













  • @DarraghEnright not intentional, i've changed my code to a better format and updated my question :)

    – Projet Sin
    Nov 23 '18 at 11:29











  • I understand now. This is not something you can configure or control directly using DateTime and DatePeriod - this is a locale based question, and DateTime does not honour locales. You have a few choices, including IntlDateFormatter if you have it installed, or strftime(). Here are some helpful answers

    – Darragh Enright
    Nov 23 '18 at 11:43











  • I tried this : echo strftime("%d %B", $dateDebutCalendrier->getTimestamp()); but this is still in English

    – Projet Sin
    Nov 23 '18 at 13:05











  • @ProjetSin - Check out the dup question, which bears an uncanny resemblance to yours, asked one week earlier. Are you and that author (kalvn) associated in some way? This seems like another case of StackOverflow déjà-vu... Can you shed some light on this phenomenon? Thanks.

    – Matt Johnson
    Nov 26 '18 at 22:25














2












2








2









This question already has an answer here:




  • PHP strftime outputs wrong format despite correct timezone

    3 answers




I am creating a DatePeriod and I want to show the names of months and days in French:



$timeZoneParis = new DateTimeZone('Europe/Paris');
$dateDebutCalendrier = new DateTime('2018-11-01', $timeZoneParis);
$dateFinCalendrier = new DateTime('2018-11-31', $timeZoneParis);
$period = new DatePeriod($dateDebutCalendrier,new DateInterval('P1D'),$dateFinCalendrier);


Expected result:




Janvier, Fevrier...




Actual result:




January, February...











share|improve this question

















This question already has an answer here:




  • PHP strftime outputs wrong format despite correct timezone

    3 answers




I am creating a DatePeriod and I want to show the names of months and days in French:



$timeZoneParis = new DateTimeZone('Europe/Paris');
$dateDebutCalendrier = new DateTime('2018-11-01', $timeZoneParis);
$dateFinCalendrier = new DateTime('2018-11-31', $timeZoneParis);
$period = new DatePeriod($dateDebutCalendrier,new DateInterval('P1D'),$dateFinCalendrier);


Expected result:




Janvier, Fevrier...




Actual result:




January, February...






This question already has an answer here:




  • PHP strftime outputs wrong format despite correct timezone

    3 answers








php date timezone






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 23 '18 at 11:47









Darragh Enright

9,79553140




9,79553140










asked Nov 23 '18 at 11:19









Projet SinProjet Sin

757




757




marked as duplicate by Matt Johnson date
Users with the  date badge can single-handedly close date questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 26 '18 at 22:21


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









marked as duplicate by Matt Johnson date
Users with the  date badge can single-handedly close date questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 26 '18 at 22:21


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • I'm not sure what you mean by "the good time zone"? Can you edit your question to clarify 1. what result you are getting and 2. what result you expect? You're not passing a DateTimeZone to $lastDayThisMonth - is this intentional, or an omission?

    – Darragh Enright
    Nov 23 '18 at 11:23













  • @DarraghEnright not intentional, i've changed my code to a better format and updated my question :)

    – Projet Sin
    Nov 23 '18 at 11:29











  • I understand now. This is not something you can configure or control directly using DateTime and DatePeriod - this is a locale based question, and DateTime does not honour locales. You have a few choices, including IntlDateFormatter if you have it installed, or strftime(). Here are some helpful answers

    – Darragh Enright
    Nov 23 '18 at 11:43











  • I tried this : echo strftime("%d %B", $dateDebutCalendrier->getTimestamp()); but this is still in English

    – Projet Sin
    Nov 23 '18 at 13:05











  • @ProjetSin - Check out the dup question, which bears an uncanny resemblance to yours, asked one week earlier. Are you and that author (kalvn) associated in some way? This seems like another case of StackOverflow déjà-vu... Can you shed some light on this phenomenon? Thanks.

    – Matt Johnson
    Nov 26 '18 at 22:25



















  • I'm not sure what you mean by "the good time zone"? Can you edit your question to clarify 1. what result you are getting and 2. what result you expect? You're not passing a DateTimeZone to $lastDayThisMonth - is this intentional, or an omission?

    – Darragh Enright
    Nov 23 '18 at 11:23













  • @DarraghEnright not intentional, i've changed my code to a better format and updated my question :)

    – Projet Sin
    Nov 23 '18 at 11:29











  • I understand now. This is not something you can configure or control directly using DateTime and DatePeriod - this is a locale based question, and DateTime does not honour locales. You have a few choices, including IntlDateFormatter if you have it installed, or strftime(). Here are some helpful answers

    – Darragh Enright
    Nov 23 '18 at 11:43











  • I tried this : echo strftime("%d %B", $dateDebutCalendrier->getTimestamp()); but this is still in English

    – Projet Sin
    Nov 23 '18 at 13:05











  • @ProjetSin - Check out the dup question, which bears an uncanny resemblance to yours, asked one week earlier. Are you and that author (kalvn) associated in some way? This seems like another case of StackOverflow déjà-vu... Can you shed some light on this phenomenon? Thanks.

    – Matt Johnson
    Nov 26 '18 at 22:25

















I'm not sure what you mean by "the good time zone"? Can you edit your question to clarify 1. what result you are getting and 2. what result you expect? You're not passing a DateTimeZone to $lastDayThisMonth - is this intentional, or an omission?

– Darragh Enright
Nov 23 '18 at 11:23







I'm not sure what you mean by "the good time zone"? Can you edit your question to clarify 1. what result you are getting and 2. what result you expect? You're not passing a DateTimeZone to $lastDayThisMonth - is this intentional, or an omission?

– Darragh Enright
Nov 23 '18 at 11:23















@DarraghEnright not intentional, i've changed my code to a better format and updated my question :)

– Projet Sin
Nov 23 '18 at 11:29





@DarraghEnright not intentional, i've changed my code to a better format and updated my question :)

– Projet Sin
Nov 23 '18 at 11:29













I understand now. This is not something you can configure or control directly using DateTime and DatePeriod - this is a locale based question, and DateTime does not honour locales. You have a few choices, including IntlDateFormatter if you have it installed, or strftime(). Here are some helpful answers

– Darragh Enright
Nov 23 '18 at 11:43





I understand now. This is not something you can configure or control directly using DateTime and DatePeriod - this is a locale based question, and DateTime does not honour locales. You have a few choices, including IntlDateFormatter if you have it installed, or strftime(). Here are some helpful answers

– Darragh Enright
Nov 23 '18 at 11:43













I tried this : echo strftime("%d %B", $dateDebutCalendrier->getTimestamp()); but this is still in English

– Projet Sin
Nov 23 '18 at 13:05





I tried this : echo strftime("%d %B", $dateDebutCalendrier->getTimestamp()); but this is still in English

– Projet Sin
Nov 23 '18 at 13:05













@ProjetSin - Check out the dup question, which bears an uncanny resemblance to yours, asked one week earlier. Are you and that author (kalvn) associated in some way? This seems like another case of StackOverflow déjà-vu... Can you shed some light on this phenomenon? Thanks.

– Matt Johnson
Nov 26 '18 at 22:25





@ProjetSin - Check out the dup question, which bears an uncanny resemblance to yours, asked one week earlier. Are you and that author (kalvn) associated in some way? This seems like another case of StackOverflow déjà-vu... Can you shed some light on this phenomenon? Thanks.

– Matt Johnson
Nov 26 '18 at 22:25












1 Answer
1






active

oldest

votes


















0














Thanks to comment, this is the solution :



setlocale(LC_TIME, 'fr_FR','fra');
echo(strftime("%B", $dateDebutCalendrier->getTimestamp());


Small edit : i needed also to add (3*3600) to the time stamp to get the right first day of the period.






share|improve this answer
































    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Thanks to comment, this is the solution :



    setlocale(LC_TIME, 'fr_FR','fra');
    echo(strftime("%B", $dateDebutCalendrier->getTimestamp());


    Small edit : i needed also to add (3*3600) to the time stamp to get the right first day of the period.






    share|improve this answer






























      0














      Thanks to comment, this is the solution :



      setlocale(LC_TIME, 'fr_FR','fra');
      echo(strftime("%B", $dateDebutCalendrier->getTimestamp());


      Small edit : i needed also to add (3*3600) to the time stamp to get the right first day of the period.






      share|improve this answer




























        0












        0








        0







        Thanks to comment, this is the solution :



        setlocale(LC_TIME, 'fr_FR','fra');
        echo(strftime("%B", $dateDebutCalendrier->getTimestamp());


        Small edit : i needed also to add (3*3600) to the time stamp to get the right first day of the period.






        share|improve this answer















        Thanks to comment, this is the solution :



        setlocale(LC_TIME, 'fr_FR','fra');
        echo(strftime("%B", $dateDebutCalendrier->getTimestamp());


        Small edit : i needed also to add (3*3600) to the time stamp to get the right first day of the period.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 23 '18 at 14:50

























        answered Nov 23 '18 at 13:09









        Projet SinProjet Sin

        757




        757

















            Popular posts from this blog

            "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

            Alcedinidae

            Origin of the phrase “under your belt”?