DateTime::createFromFormat

Discussion about the open-source Phalanger [?] project.

DateTime::createFromFormat

Postby compucoder » November 7th, 2012, 6:24 pm

When I use this method in Phalanger the compiler errors out saying the method does not exist in class DateTime.

This method was introduced in 5.3.0. It seems to be missing from the current version of Phalanger.

http://ca1.php.net/manual/en/datetime.c ... format.php
compucoder
 
Posts: 12
Joined: August 16th, 2012, 12:29 pm

Re: DateTime::createFromFormat

Postby Jakub Misek » November 7th, 2012, 7:05 pm

Thanks, we'll add it onto todo list or if you know anybody willing to help, he can contribute to Phalanger repository https://github.com/DEVSENSE/Phalanger

Thanks,
Jakub Misek │ DEVSENSE s.r.o. | @misekjakubjakub@devsense.com
User avatar
Jakub Misek
 
Posts: 2092
Joined: January 4th, 2012, 2:42 pm
Location: Prague

Re: DateTime::createFromFormat

Postby compucoder » November 7th, 2012, 8:01 pm

I don't mind taking a crack at adding it. I am not a pro C# programmer but may be able to attempt it. It would be a fun challenge for sure. Can you tell me what folder and file I should start at? I don't know your source so findng where DateTime class is even coded would take a long time.
compucoder
 
Posts: 12
Joined: August 16th, 2012, 12:29 pm

Re: DateTime::createFromFormat

Postby Jakub Misek » November 7th, 2012, 8:16 pm

Sure, That would be great!

https://github.com/DEVSENSE/Phalanger/b ... ateTime.cs

Notice every method has two overloads
- ArgLess, used for dynamic operations, has always this signature
Code: Select all
[EditorBrowsable(EditorBrowsableState.Never)]
public static object modify(object instance, PhpStack stack)
and calls ArgFull with all parameters (we will probably remove ArgLesses in future update)

- ArgFull is the method implementation, first arg is always ScriptContext, others are of type Object. Method returns Object.
Code: Select all
[ImplementsMethod]
public object modify(ScriptContext/*!*/context, object modify)
The attributes are also important to Phalanger.

The rest is just coding.

Thanks!
Jakub Misek │ DEVSENSE s.r.o. | @misekjakubjakub@devsense.com
User avatar
Jakub Misek
 
Posts: 2092
Joined: January 4th, 2012, 2:42 pm
Location: Prague

Re: DateTime::createFromFormat

Postby compucoder » November 7th, 2012, 8:32 pm

I downloaded the source and had a look and found where to do the work. Thanks for pointing me in the right direction. I would have found it easily based on how well organized the code is. You guys have done a wondeful job on this product!

I did hit a glitch though. I opened the Solution and when I try to build it I get the same errors over and over;

Error 1 Metadata file 'C:\Users\rcraig\Documents\Visual Studio 2012\Projects\Phalanger-master\Source\ClassLibrary\Bin\Debug\PhpNetClassLibrary.dll' could not be found C:\Users\rcraig\Documents\Visual Studio 2012\Projects\Phalanger-master\Source\Testing\Unit\CSC Testers.Unit
Error 2 Metadata file 'C:\Users\rcraig\Documents\Visual Studio 2012\Projects\Phalanger-master\Source\Core\Bin\Debug\PhpNetCore.dll' could not be found C:\Users\rcraig\Documents\Visual Studio 2012\Projects\Phalanger-master\Source\Testing\Unit\CSC Testers.Unit


I get 23 of these. It also can't find PhpNetClassLibrary.dll - not sure what is wrong; I would expect it to build these dll's. The build order does the core and library's first.

Am I missing something or doing something wrong?
compucoder
 
Posts: 12
Joined: August 16th, 2012, 12:29 pm

Re: DateTime::createFromFormat

Postby Jakub Misek » November 7th, 2012, 10:57 pm

Thanks! I don't know what is wrong, simply unload Testers.Unit if it would help.
Jakub Misek │ DEVSENSE s.r.o. | @misekjakubjakub@devsense.com
User avatar
Jakub Misek
 
Posts: 2092
Joined: January 4th, 2012, 2:42 pm
Location: Prague

Re: DateTime::createFromFormat

Postby compucoder » November 7th, 2012, 11:57 pm

That didn't help. It seems to all start from a .cmd updater in the tools folder. I will install my 2010 VS pro and see if things work better. I am using VS2012. I did update the common tools paths but maybe there is more incompatabilities.
compucoder
 
Posts: 12
Joined: August 16th, 2012, 12:29 pm

Re: DateTime::createFromFormat

Postby compucoder » November 8th, 2012, 1:54 pm

I am still unable to contribute to compile failures. The errors seem to originate from the Core failing to build the main assembly. I think everything is originating from this error:

Error 22 The command "cd "C:\Users\rcraig\Documents\Visual Studio 2010\Projects\Phalanger-master\Solutions\.."
Tools\UpdateFileVersionFromChangeset.cmd "C:\Users\rcraig\Documents\Visual Studio 2010\Projects\Phalanger-master\Source\Core\AssemblyInfo.cs"" exited with code 255. Core

Any idea what may be wrong?
compucoder
 
Posts: 12
Joined: August 16th, 2012, 12:29 pm

Re: DateTime::createFromFormat

Postby compucoder » November 8th, 2012, 5:15 pm

Hi Jakub,

I got around this issue by taking the prebuild step away.

I started looking at adding the missing method but got stumped. It requires you to return a static DateTime object. I have no clue how to do that. Even if I could add this in I also need Diff which is also missing; and that needs a new class called DateInterval. I am not experienced enough with C# or this project to tackle all of this.

If you or someone experienced in the project can add createFromFormat, maybe I can try and help with Diff and DateInterval.

I really need to see new code being done that is in the context of what I am needing so my brain clicks in.

I wish I was a more experienced C# developer so I can contribute. I really want to but need a bit of help as stated above.
compucoder
 
Posts: 12
Joined: August 16th, 2012, 12:29 pm

Re: DateTime::createFromFormat

Postby Jakub Misek » November 8th, 2012, 7:05 pm

Hi,

As I see, this is tricky one. DateTime::createFromFormat is not trivial function, but it does not needed anything new, everything is already coded in Phalanger. So I guess somebody will surely do it.

I submitted some stub on GitHub
https://github.com/DEVSENSE/Phalanger/c ... 740d887ec8
so somebody can finish it.

Thanks,
Jakub Misek │ DEVSENSE s.r.o. | @misekjakubjakub@devsense.com
User avatar
Jakub Misek
 
Posts: 2092
Joined: January 4th, 2012, 2:42 pm
Location: Prague

Next

Return to Phalanger project

Who is online

Users browsing this forum: No registered users and 24 guests

cron

User Control Panel

Login

Who is online

In total there are 24 users online :: 0 registered, 0 hidden and 24 guests (based on users active over the past 5 minutes)
Most users ever online was 297 on March 29th, 2024, 7:06 am

Users browsing this forum: No registered users and 24 guests