working with dates

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

working with dates

Kel Graham
Hello,

I'd like to see how to control the formatting and storage of dates. I'm in the UK so would like to store my dates in yyyy-mm-dd format, but display them as dd-mm-yyyy; or as '12 December 2006' sometimes as well. I've looked at the Date class, but apart from the printFormat: method (which I can't see an explanation of the format) I can't see any easy way of ensuring that squeak converts my dd-mm-yyyy input into a nice ISO yyyy-mm-dd format.

Could anyone suggest some classes/code to look at?


Thanks very much,
Kel.



_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: working with dates

Mathieu SUEN
Have a look at #yyyymmdd

And the test:

testPrinting

        self
                assert: date mmddyyyy = '6/2/1973';
                assert: date yyyymmdd = '1973-06-02';
                assert: (date printFormat: #(3 1 2 $! 2 1 1)) = '1973!2!Jun'.

HTH

2006/12/12, Kel Graham <[hidden email]>:

> Hello,
>
> I'd like to see how to control the formatting and storage of dates. I'm in
> the UK so would like to store my dates in yyyy-mm-dd format, but display
> them as dd-mm-yyyy; or as '12 December 2006' sometimes as well. I've looked
> at the Date class, but apart from the printFormat: method (which I can't see
> an explanation of the format) I can't see any easy way of ensuring that
> squeak converts my dd-mm-yyyy input into a nice ISO yyyy-mm-dd format.
>
> Could anyone suggest some classes/code to look at?
>
>
> Thanks very much,
> Kel.
>
>
>
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>
>
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: working with dates

Kel Graham-2
Ah - thank you!

It took me a while to realise what the second half of the printFormat: statement was saying, but got there in the end.

Also, thanks for pointing out the tests in Kernel-Chronology-Tests.. I kept looking at the Date class, never realising that there were lots of tests in the next category! A quick use of Method Finder helped me find them..

Cheers,
Kel.

On 12/12/06, Mathieu SUEN <[hidden email]> wrote:
Have a look at #yyyymmdd

And the test:

testPrinting

        self
                assert: date mmddyyyy = '6/2/1973';
                assert: date yyyymmdd = '1973-06-02';
                assert: (date printFormat: #(3 1 2 $! 2 1 1)) = '1973!2!Jun'.

HTH

2006/12/12, Kel Graham <[hidden email]>:

> Hello,
>
> I'd like to see how to control the formatting and storage of dates. I'm in
> the UK so would like to store my dates in yyyy-mm-dd format, but display
> them as dd-mm-yyyy; or as '12 December 2006' sometimes as well. I've looked
> at the Date class, but apart from the printFormat: method (which I can't see
> an explanation of the format) I can't see any easy way of ensuring that
> squeak converts my dd-mm-yyyy input into a nice ISO yyyy-mm-dd format.
>
> Could anyone suggest some classes/code to look at?
>
>
> Thanks very much,
> Kel.
>
>
>
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>
>
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners



--
Kel Graham
www.savvant.com
[hidden email]
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: working with dates

Mathieu SUEN
yes great.
 that how you can work farst. :)
You can use the short cut like  alt-m alt-n alt-b alt-shift-n(depend
on wheter you are in windows or mac) and so on to find your piece of
code faster.
Loook at the menu to find the meaning.


     Math

2006/12/12, Kel Graham <[hidden email]>:

> Ah - thank you!
>
> It took me a while to realise what the second half of the printFormat:
> statement was saying, but got there in the end.
>
> Also, thanks for pointing out the tests in Kernel-Chronology-Tests.. I kept
> looking at the Date class, never realising that there were lots of tests in
> the next category! A quick use of Method Finder helped me find them..
>
> Cheers,
> Kel.
>
>
> On 12/12/06, Mathieu SUEN <[hidden email]> wrote:
> > Have a look at #yyyymmdd
> >
> > And the test:
> >
> > testPrinting
> >
> >         self
> >                 assert: date mmddyyyy = '6/2/1973';
> >                 assert: date yyyymmdd = '1973-06-02';
> >                 assert: (date printFormat: #(3 1 2 $! 2 1 1)) =
> '1973!2!Jun'.
> >
> > HTH
> >
> > 2006/12/12, Kel Graham <[hidden email]>:
> > > Hello,
> > >
> > > I'd like to see how to control the formatting and storage of dates. I'm
> in
> > > the UK so would like to store my dates in yyyy-mm-dd format, but display
> > > them as dd-mm-yyyy; or as '12 December 2006' sometimes as well. I've
> looked
> > > at the Date class, but apart from the printFormat: method (which I can't
> see
> > > an explanation of the format) I can't see any easy way of ensuring that
> > > squeak converts my dd-mm-yyyy input into a nice ISO yyyy-mm-dd format.
> > >
> > > Could anyone suggest some classes/code to look at?
> > >
> > >
> > > Thanks very much,
> > > Kel.
> > >
> > >
> > >
> > > _______________________________________________
> > > Beginners mailing list
> > > [hidden email]
> > >
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
> > >
> > >
> > >
> > _______________________________________________
> > Beginners mailing list
> > [hidden email]
> >
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
> >
>
>
>
> --
> Kel Graham
> www.savvant.com
> [hidden email]
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>
>
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners