to get the system date / time?

View: New views
7 Messages — Rating Filter:   Alert me  

to get the system date / time?

by dglnz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I would like to be able to get the PC system date/time as you can in ruby.

not exactly sure why i'm not getting it currently!

I'm doing this at the moment.

mydate = Date
mytime = Time

these failed so added a .now and it still failed!!!

looked at the fxruby Rdoc site and found no luck their as yet (and googled)!

dave.

Email slow, clunky, unreliable? Switch to Yahoo!Xtra Mail, New Zealand's new email address.
_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users

Re: to get the system date / time?

by Nataraj :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi

Try this

require 'date'

@appldate= FXDataTarget.new(Date.today().to_s)

        FXLabel.new(frame, "APPL Date",:opts => JUSTIFY_LEFT|LAYOUT_FILL_X)

        FXTextField.new(frame, 10,@appldate, FXDataTarget::ID_VALUE) do |theTextField|

        theTextField.layoutHints = LAYOUT_FIX_X|LAYOUT_FIX_Y

        theTextField.text=@...
end

regards

Nataraj
On Tue, Aug 25, 2009 at 5:30 PM, dave L<dglnz@...> wrote:

> I would like to be able to get the PC system date/time as you can in ruby.
>
> not exactly sure why i'm not getting it currently!
>
> I'm doing this at the moment.
>
> mydate = Date
> mytime = Time
>
> these failed so added a .now and it still failed!!!
>
> looked at the fxruby Rdoc site and found no luck their as yet (and googled)!
>
> dave.
>
> Email slow, clunky, unreliable? Switch to Yahoo!Xtra Mail, New Zealand's new
> email address.
> _______________________________________________
> fxruby-users mailing list
> fxruby-users@...
> http://rubyforge.org/mailman/listinfo/fxruby-users
>
_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users

Re: to get the system date / time?

by Len Lawrence :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

dave L wrote:

> I would like to be able to get the PC system date/time as you can in ruby.
>
> not exactly sure why i'm not getting it currently!
>
> I'm doing this at the moment.
>
> mydate = Date
> mytime = Time
>
> these failed so added a .now and it still failed!!!
>
> looked at the fxruby Rdoc site and found no luck their as yet (and
> googled)!
>
> dave.
>
>
> Email slow, clunky, unreliable? Switch to Yahoo!Xtra Mail
> <http://au.rd.yahoo.com/nz/mail/tagline/2009/mailsignup/*http://yahoo.co.nz/mail>,
> New Zealand's new email address.
>
> ------------------------------------------------------------------------
Have you got

require 'date'

in your header section?

I have this in one of my non FX scripts:

Today = (DateTime.now).to_s.slice( 0, 10 ).tr( '-', ' ' )

to get the year, month and day.

Len



_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users

Re: to get the system date / time?

by dglnz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Len,

Many thanks,

two two others sent me similar pointers and i had taken it for granted that FXruby might have had it's own datetime handling routines - Doh light has since switched on

Dave.

--- On Wed, 26/8/09, Len Lawrence <lcl@...> wrote:

> From: Len Lawrence <lcl@...>
> Subject: Re: [fxruby-users] to get the system date / time?
> To: fxruby-users@...
> Received: Wednesday, 26 August, 2009, 12:33 AM
> dave L wrote:
> > I would like to be able to get the PC system date/time
> as you can in ruby.
> >
> > not exactly sure why i'm not getting it currently!
> >
> > I'm doing this at the moment.
> >
> > mydate = Date
> > mytime = Time
> >
> > these failed so added a .now and it still failed!!!
> >
> > looked at the fxruby Rdoc site and found no luck their
> as yet (and
> > googled)!
> >
> > dave.
> >
> >
> > Email slow, clunky, unreliable? Switch to Yahoo!Xtra
> Mail
> > <http://au.rd.yahoo.com/nz/mail/tagline/2009/mailsignup/*http://yahoo.co.nz/mail>,
>
> > New Zealand's new email address.
> >
> >
> ------------------------------------------------------------------------
> Have you got
>
> require 'date'
>
> in your header section?
>
> I have this in one of my non FX scripts:
>
> Today = (DateTime.now).to_s.slice( 0, 10 ).tr( '-', ' ' )
>
> to get the year, month and day.
>
> Len
>
>
>
> _______________________________________________
> fxruby-users mailing list
> fxruby-users@...
> http://rubyforge.org/mailman/listinfo/fxruby-users
>


     
_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users

Parent Message unknown Re: to get the system date / time?

by Joey Kinsella :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm not 100% sure, but you should be able to just do:

require 'time'

my_date = Date.now
my_time = Time.now
------Original Message------
From: Len Lawrence
Sender: fxruby-users-bounces@...
To: fxruby-users@...
ReplyTo: fxruby-users@...
Subject: Re: [fxruby-users] to get the system date / time?
Sent: Aug 25, 2009 8:33 AM

dave L wrote:

> I would like to be able to get the PC system date/time as you can in ruby.
>
> not exactly sure why i'm not getting it currently!
>
> I'm doing this at the moment.
>
> mydate = Date
> mytime = Time
>
> these failed so added a .now and it still failed!!!
>
> looked at the fxruby Rdoc site and found no luck their as yet (and
> googled)!
>
> dave.
>
>
> Email slow, clunky, unreliable? Switch to Yahoo!Xtra Mail
> <http://au.rd.yahoo.com/nz/mail/tagline/2009/mailsignup/*http://yahoo.co.nz/mail>,
> New Zealand's new email address.
>
> ------------------------------------------------------------------------
Have you got

require 'date'

in your header section?

I have this in one of my non FX scripts:

Today = (DateTime.now).to_s.slice( 0, 10 ).tr( '-', ' ' )

to get the year, month and day.

Len



_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users

_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users

Re: to get the system date / time?

by dglnz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yes I have since found out from my 1st posting for help that I had to require date in and so time too.

Have a need also to split text from a FXList into other controls (allow data to be changed) and bashed my head as i thought i'd have to invent the wheel again not thinking about just requiring string to do the heavy lifting for me).

So i have now been able to kill more birds with the one call for help.

By the way have you played with foxGUI?

I'm very much a noob with both ruby, FXruby and foxGUI.

but making head way in 2 steps forward 1 back.

many thanks for your relpy.

Dave.

PS sending this to you personnally as posting to list won't enlighten other anymore than what has been posted on my date/time question and reply to date, BUT I am interested in hearing back from you on the foxGUI as i'd like to get someone with more experiance to help me with some problems i have with it.



--- On Thu, 27/8/09, jkinsella@... <jkinsella@...> wrote:

> From: jkinsella@... <jkinsella@...>
> Subject: Re: [fxruby-users] to get the system date / time?
> To: fxruby-users@...
> Received: Thursday, 27 August, 2009, 10:49 AM
> I'm not 100% sure, but you should be
> able to just do:
>
> require 'time'
>
> my_date = Date.now
> my_time = Time.now
> ------Original Message------
> From: Len Lawrence
> Sender: fxruby-users-bounces@...
> To: fxruby-users@...
> ReplyTo: fxruby-users@...
> Subject: Re: [fxruby-users] to get the system date / time?
> Sent: Aug 25, 2009 8:33 AM
>
> dave L wrote:
> > I would like to be able to get the PC system date/time
> as you can in ruby.
> >
> > not exactly sure why i'm not getting it currently!
> >
> > I'm doing this at the moment.
> >
> > mydate = Date
> > mytime = Time
> >
> > these failed so added a .now and it still failed!!!
> >
> > looked at the fxruby Rdoc site and found no luck their
> as yet (and
> > googled)!
> >
> > dave.
> >
> >
> > Email slow, clunky, unreliable? Switch to Yahoo!Xtra
> Mail
> > <http://au.rd.yahoo.com/nz/mail/tagline/2009/mailsignup/*http://yahoo.co.nz/mail>,
>
> > New Zealand's new email address.
> >
> >
> ------------------------------------------------------------------------
> Have you got
>
> require 'date'
>
> in your header section?
>
> I have this in one of my non FX scripts:
>
> Today = (DateTime.now).to_s.slice( 0, 10 ).tr( '-', ' ' )
>
> to get the year, month and day.
>
> Len
>
>
>
> _______________________________________________
> fxruby-users mailing list
> fxruby-users@...
> http://rubyforge.org/mailman/listinfo/fxruby-users
>
> _______________________________________________
> fxruby-users mailing list
> fxruby-users@...
> http://rubyforge.org/mailman/listinfo/fxruby-users
>


     
_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users

Re: to get the system date / time?

by Len Lawrence :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

dave L wrote:

> Yes I have since found out from my 1st posting for help that I had to require date in and so time too.
>
> Have a need also to split text from a FXList into other controls (allow data to be changed) and bashed my head as i thought i'd have to invent the wheel again not thinking about just requiring string to do the heavy lifting for me).
>
> So i have now been able to kill more birds with the one call for help.
>
> By the way have you played with foxGUI?
>
> I'm very much a noob with both ruby, FXruby and foxGUI.
>
> but making head way in 2 steps forward 1 back.
>
> many thanks for your relpy.
>
> Dave.
>
> PS sending this to you personnally as posting to list won't enlighten other anymore than what has been posted on my date/time question and reply to date, BUT I am interested in hearing back from you on the foxGUI as i'd like to get someone with more experiance to help me with some problems i have with it.
>
>
Sorry Dave, I don't have any experience with foxGUI.  I have actually
stopped using FOX altogether and gone back to using Tk.  18 years
experience with Tcl/Tk so it was natural to adopt RubyTk.  fxruby fits
in better with the object hierarchy of Ruby but Tk has functionality
which hardly exists in other graphic toolkits and which I need every
day, like an intuitive listbox and the peerless TkCanvas.

Good luck with the learning curve.  I have been programming for 46 years
but am still on the learning curve.  Like you it is still 2 steps
forward and 1 back, or even +3 -2.

Len



_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users