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

  • Home
  • SEARCH
  • 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 6161047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:25:02+00:00 2026-05-23T21:25:02+00:00

Im trying to create a php function that converts a string date to a

  • 0

Im trying to create a php function that converts a string date to a java date to pass to java. I need to use java.sql.Date not java.util.Date for my application. But this simple function is giving an odd result:

function makeStrJavaDate($date){
    $date = date_parse($date);
    $date = new Java("java.sql.Date",$date['year'], $date['month']-1, $date['day']);
    return $date;
}

The date java returned has the wrong year: php (For 2011-07-01), java(Jul 1, 3911).

Any pointers as to whats wrong?

FYI, php is parsing it correctly:

Array
(
    [year] => 2011
    [month] => 7
    [day] => 1
    [hour] => 
    [minute] => 
    [second] => 
    [fraction] => 
    [warning_count] => 0
    [warnings] => Array
        (
        )

    [error_count] => 0
    [errors] => Array
        (
        )

    [is_localtime] => 
)
  • 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-05-23T21:25:03+00:00Added an answer on May 23, 2026 at 9:25 pm

    Evidently, it’s considering the year to start at 1900. So subtract 1900 when you pass the year.

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

Sidebar

Related Questions

I am trying to create a PHP function that Ciphers a string using a
I'm trying to create a PHP file that calls a function in another file.
I'm trying to create a simple poll function using php and sql. I have
I am trying to create a function that would parse php code and return
I am trying to create a php file that adds a user and create
I'm trying to create system users with a php script securely, In that, I'd
I'm trying to create a generic class in PHP that will provide a way
I'm trying to create an SQL query in PHP to update a table. Is
I'm trying to use the simple_html_dom php class to create a find and replace
I'm trying to convert this function into PHP but somehow it does not give

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.