Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8067711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T12:24:51+00:00 2026-06-05T12:24:51+00:00

I have a set of date strings in the following format: $date = ‘month_name

  • 0

I have a set of date strings in the following format:

$date = 'month_name DD, YYYY';

What I would like to do is shorten the month name to 3 characters and remove the year from the end like this:

$output = 'June 10, 2012';
print $output // Outputs 'Jun 10';

So far I have the following, but have not been able to find a method to shorten the first word:

print substr($date, 0, strrpos($date, ',')); // Outputs 'June 10';

Any help would be appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T12:24:53+00:00Added an answer on June 5, 2026 at 12:24 pm

    Use PHP’s DateTime class:

    $string = 'June 10, 2012';
    $date = DateTime::createFromFormat('F d, Y', $string, new DateTimeZone('America/New_York'));
    echo $date->format('M d'); // Output: Jun 10
    

    This is a very stable way to convert times between different formats.

    Demo

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a varchar column which contains date in following format dd/mm/yyyy I need
I have the following data set structure: date time_in_hours price Sep 03 08 9.76
I have the following code: DECLARE @testDate date --SET @testDate=dateadd(wk, 5830, 0) SET @testDate='2011-09-26
I have a DataGridView set up with the following columns: Teacher, Subject, Date, Period.
I have a java programe which I can set a date in yyyy-MM-dd and
I have following method that I would like to make shorter or faster if
I have several strings that look like the following: +H124005992014011/1527399999999I05Z +H7039700000001/$99999999I051 +K122005962050171/120911234C117 I need
I have this query which returns a result set with Date(column) as nvarchar datatype.
I have to create an app in which I must set a date and
I have been trying to set AlarmManager for Specific date, but it is not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.