Author Topic: getting system date and time  (Read 2244 times)

sparkythex

  • Newbie
  • *
  • Posts: 43
getting system date and time
« on: November 16, 2012, 09:40:14 PM »
I could not find how to do this, sorry if it is somewhere.

I want to pull whatever the system date & time is.
However I want to sometimes keep the values separate (or separate them, if they get pulled as one value).

Example one:  I may want date in one text box & time in another box.   
Example two:  I may want to show date & time all in the same box "1:25 PM 11/16/2012"; or the other way "11/16/2012 1:26 PM"

Also I may want to break up the date, to be three text boxes of:    MM (month) then DD (Day) then YYYY (Year). 
I may want to do the same with time, to have three text boxes of:   HH (Hour) then MM(Minute) then SS (Second)

Can you help with that?

sparkythex

  • Newbie
  • *
  • Posts: 43
Re: getting system date and time
« Reply #1 on: November 16, 2012, 10:22:10 PM »
Oh I finally found this in the help file.

DateNowFN

Malkom

  • Administrator
  • Newbie
  • *****
  • Posts: 381
  • Here to help you
Re: getting system date and time
« Reply #2 on: November 17, 2012, 07:01:43 AM »
Yes, thats it :)

DateNowFN creates the total number of seconds for the current time and this can be used to build formatted date and time strings.

Code: [Select]
Local tnow

Put DateNowFN into tnow
Put tnow into field 1

Put DateShortTimeFN(tnow) into field 2

Put DateShortDateFN(tnow) into field 3


and the output is:-

field 1 contains 3435980287

field 2 contains 06:58

field 3 contains 17/11/12

Page 58 of the Language Reference PDF contains more date/time functions, and as you have already found so does the inbuilt help (for other - Guide from menu)
I am sorry but I do not have time to answer questions by PM or email.
If you post your questions in this forum then it might help others.

 

anything