This is a read-only archive of lispforum.com. The forum was locked to new users and posts and is preserved here as static HTML from a database snapshot taken on 2019-09-07.

Get current month

8 posts · 1419 views

Hi all,

Sorry but I can't get current month :(.
How can I do it?

Thanks,
bye

Re: Get current month

Stiv wrote:Hi all,

Sorry but I can't get current month :(.
How can I do it?

Thanks,
bye
I'm thinking you're going to want at least two of these functions:
multiple-value-bind
decode-universal-time
get-universal-time
Look them up if you don't know what they are.
"If you want to improve, be content to be thought foolish and stupid." -Epictetus

Re: Get current month

Thanks very much,

I've done so:
(multiple-value-bind (s min b gg m a b2 b3 b4) 
     (decode-universal-time (get-universal-time))
   (list m))
but it generates many style-warning, how can I improve it?

Thanks,

Bye

Re: Get current month

Try this:
(multiple-value-bind (s min b gg m a b2 b3 b4) 
     (decode-universal-time (get-universal-time))
   (declare (ignore s min b gg a b2 b3 b4))
   (list m))

Re: Get current month

Thanks, it works.

Re: Get current month

A 1-liner:
(fifth (multiple-value-list (decode-universal-time (get-universal-time))))

Re: Get current month

Another 1-liner =)
(nth-value 4 (decode-universal-time (get-universal-time)))
Need an online wiki database? My Lisp startup http://www.formlis.com combines a wiki with forms and reports.

Re: Get current month

Thanks very much :)