Reputation: 177
What's the momentjs (JavaScript) equivalent of
PHP : <?php echo date('D, M d Y') ?>
JavaScript : new moment("2020-04-02 11:00:00").format('D, M d Y')
I can't do much formatting natively with .toDateString()
Upvotes: 0
Views: 613
Reputation: 44037
PHP's date()
and momentjs.format()
uses other format options;
PHP MOMENT ?
D ddd Mon through Sun
M MMM Jan through Dec
d DD Mon through Sun
Y YYYY 2020
PHP date docs -- MomentJSFormat docs
const mom = new moment('2020-04-02 11:00:00');
console.log(mom.format('ddd, MMM DD YYYY')); // Thu, Apr 02 2020
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/moment.min.js"></script>
Upvotes: 1