Jump to page: 1 2
Thread overview
std.dateparse reincarnation
Oct 13, 2011
Jesse Phillips
Oct 13, 2011
Vladimir Panteleev
Oct 13, 2011
Jonathan M Davis
Oct 14, 2011
Jesse Phillips
Oct 14, 2011
Jonathan M Davis
Oct 15, 2011
Steve Teale
Oct 15, 2011
Walter Bright
Oct 29, 2011
Jonathan M Davis
Oct 25, 2011
Stewart Gordon
Oct 25, 2011
Jonathan M Davis
Oct 25, 2011
Stewart Gordon
Oct 25, 2011
Jonathan M Davis
Oct 26, 2011
Stewart Gordon
Oct 26, 2011
Jonathan M Davis
Oct 28, 2011
Stewart Gordon
Oct 28, 2011
Jonathan M Davis
Oct 25, 2011
Walter Bright
Oct 25, 2011
Stewart Gordon
October 13, 2011
Thought I would let everyone know that while std.dateparse is deprecated and will be removed from Phobos in February, I've updated it to output a std.datetime.SysTime.

https://gist.github.com/1283011

I don't have any interest in maintaining it, but since I did use it I updated it for me.
October 13, 2011
On Thu, 13 Oct 2011 07:22:06 +0300, Jesse Phillips <jessekphillips+d@gmail.com> wrote:

> Thought I would let everyone know that while std.dateparse is deprecated
> and will be removed from Phobos in February, I've updated it to output a
> std.datetime.SysTime.
>
> https://gist.github.com/1283011
>
> I don't have any interest in maintaining it, but since I did use it I
> updated it for me.

Time formatting and parsing seems like a gap of missing functionality in Phobos 2.

I've written something to format and parse SysTimes using format strings based on the format PHP uses for its date() function:
https://github.com/CyberShadow/ae/blob/master/utils/time.d

Feel free to use this file as public domain.

-- 
Best regards,
 Vladimir                            mailto:vladimir@thecybershadow.net
October 13, 2011
On Thursday, October 13, 2011 22:09:39 Vladimir Panteleev wrote:
> Time formatting and parsing seems like a gap of missing functionality in Phobos 2.

It formats and parses specific, official formats just fine, but it doesn't currently support user-defined formats. It's on my TODO list. Eventually, there will be something along the lines of toCustomString and fromCustomString on Date, TimeOfDay, DateTime, and SysTime, where they take a format string defining the custom format.

- Jonathan M Davis
October 14, 2011
On Thu, 13 Oct 2011 12:13:40 -0700, Jonathan M Davis wrote:

> On Thursday, October 13, 2011 22:09:39 Vladimir Panteleev wrote:
>> Time formatting and parsing seems like a gap of missing functionality in Phobos 2.
> 
> It formats and parses specific, official formats just fine, but it doesn't currently support user-defined formats. It's on my TODO list. Eventually, there will be something along the lines of toCustomString and fromCustomString on Date, TimeOfDay, DateTime, and SysTime, where they take a format string defining the custom format.
> 
> - Jonathan M Davis

For my use dateparse was actually want I wanted. I was pulling out strings saying, "Hey this looks like it might be a date, what do you think?" "Yeah, cool thank you." I don't wish to try and push it back into Phobos but thought others may well still be interested as I was.
October 14, 2011
On Friday, October 14, 2011 04:51:58 Jesse Phillips wrote:
> On Thu, 13 Oct 2011 12:13:40 -0700, Jonathan M Davis wrote:
> > On Thursday, October 13, 2011 22:09:39 Vladimir Panteleev wrote:
> >> Time formatting and parsing seems like a gap of missing functionality in Phobos 2.
> > 
> > It formats and parses specific, official formats just fine, but it doesn't currently support user-defined formats. It's on my TODO list. Eventually, there will be something along the lines of toCustomString and fromCustomString on Date, TimeOfDay, DateTime, and SysTime, where they take a format string defining the custom format.
> > 
> > - Jonathan M Davis
> 
> For my use dateparse was actually want I wanted. I was pulling out strings saying, "Hey this looks like it might be a date, what do you think?" "Yeah, cool thank you." I don't wish to try and push it back into Phobos but thought others may well still be interested as I was.

That's fine. Vladimir was saying that std.datetime's formatting and parsing abilities left something to be desired, so I was pointing out that I do intend to give it the ability to handle custom formats. It's not really my intention at this point that std.datetime gain the ability to take a string representing a date and/or time in an unknown format. There's obviously no problem with you making such code available for those who might want it though.

- Jonathan M Davis
October 15, 2011
On Thu, 13 Oct 2011 22:09:39 +0300, Vladimir Panteleev wrote:

> On Thu, 13 Oct 2011 07:22:06 +0300, Jesse Phillips <jessekphillips+d@gmail.com> wrote:
> 
>> Thought I would let everyone know that while std.dateparse is deprecated and will be removed from Phobos in February, I've updated it to output a std.datetime.SysTime.
>>
>> https://gist.github.com/1283011
>>
>> I don't have any interest in maintaining it, but since I did use it I updated it for me.
> 
> Time formatting and parsing seems like a gap of missing functionality in Phobos 2.
> 
> I've written something to format and parse SysTimes using format strings based on the format PHP uses for its date() function: https://github.com/CyberShadow/ae/blob/master/utils/time.d
> 
> Feel free to use this file as public domain.

Yes, me too. I used to get tremendously frustrated with the old std.date, because all I wanted to do was get the current time and write it into a log file!

Steve
October 15, 2011
On 10/14/2011 9:21 PM, Steve Teale wrote:
> I used to get tremendously frustrated with the old std.date,
> because all I wanted to do was get the current time and write it into a
> log file!

Are you sure you're worthy? :-)
October 25, 2011
On 13/10/2011 20:09, Vladimir Panteleev wrote:
<snip>
> I've written something to format and parse SysTimes using format strings based on the
> format PHP uses for its date() function:
> https://github.com/CyberShadow/ae/blob/master/utils/time.d
>
> Feel free to use this file as public domain.

My library includes a date/time formatting facility that's much better than PHP's.

http://pr.stewartsplace.org.uk/d/sutil/

Spec of the format string scheme:
http://pr.stewartsplace.org.uk/d/sutil/datetime_format.html

Walter - when the time comes to implement custom date/time formatting, will you consider using my scheme?

Stewart.
October 25, 2011
On Tuesday, October 25, 2011 20:17:35 Stewart Gordon wrote:
> On 13/10/2011 20:09, Vladimir Panteleev wrote:
> <snip>
> 
> > I've written something to format and parse SysTimes using format strings based on the format PHP uses for its date() function: https://github.com/CyberShadow/ae/blob/master/utils/time.d
> > 
> > Feel free to use this file as public domain.
> 
> My library includes a date/time formatting facility that's much better than PHP's.
> 
> http://pr.stewartsplace.org.uk/d/sutil/
> 
> Spec of the format string scheme: http://pr.stewartsplace.org.uk/d/sutil/datetime_format.html
> 
> Walter - when the time comes to implement custom date/time formatting, will you consider using my scheme?

What does Walter have to do with anything here? He's not implementing any date/time stuff, and he's not all that involved with Phobos development in general. I'm likely the one to be implementing the custom date/time formatting, and the current plan is to do something similar to strftime, since that scheme seems to be fairly standard across several languages.

- Jonathan M Davis
October 25, 2011
On 13/10/2011 05:22, Jesse Phillips wrote:
> Thought I would let everyone know that while std.dateparse is deprecated
> and will be removed from Phobos in February, I've updated it to output a
> std.datetime.SysTime.
>
> https://gist.github.com/1283011
>
> I don't have any interest in maintaining it, but since I did use it I
> updated it for me.

The locale detection is broken, as this example shows.

----- dateparse_test.d -----
import dateparse, std.cstream, std.datetime;

void main() {
	string s;
	while ((s = din.readLine().idup) != "") {
		SysTime t;
		dateParse(s, t);
		dout.writefln("%s", t);
	}
}
----- output -----
C:\Users\Stewart\Documents\Programming\D\thirdp>dateparse_test
12/10/2011
2011-Dec-10 00:00:00
29/10/2011
dateparse.DateParseException@dateparse.d(35): Invalid date string: 29/10/2011
----------------
46B4A8
46B31F
402145
402085
403300
40333F
402F3B
49E6F9
49E650
----------------
----------

Stewart.
« First   ‹ Prev
1 2