PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, March 1, 2022

[FIXED] Extract date from long complicated date plus time stamp?

 March 01, 2022     codeigniter, javascript, jquery, php, twitter-bootstrap     No comments   

Issue

I am using bootstrap calendar and on clicking any particular date I got complicated date in this form:

Sat Sep 06 2014 00:00:00 GMT 0500 (Pakistan Standard Time)

Can anybody please tell me how I can extract only date from this complicated long date?

I am working in PHP codeignitor, is there any way in PHP or JavaScript through which I can only extract date?


Solution

if this is for Javascript then just use this:

var myDate = new Date('Sat Sep 06 2014 00:00:00 GMT 0500 (Pakistan Standard Time)');

after that you can use myDate as a date object and call its methods like myDate.getFullYear() etc.



Answered By - Tiberiu Petcu
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing