Hi Kerry ,

You can from a dateObject (which is in a standard format) to get the year/month/dayseconds from midnight.

dateObj= (the systemDate)

or dateObj = date(2004, 12, 31)
or dateObj = date("20041231")
or if you want to include hours/minutes/seconds, it seems that you have to set the seconds property after you create the date object.

dateObj = date(2004, 12, 31)
t = hour * 3600 + mins * 60 + seconds
dateObj.seconds = t

The you can use dot syntax to get the bits

year = dateObj.year
month = dateObj.month
day = dateObj.day

Getting the hour and minutes involves using the .seconds property (at least with MX, I dont know if it has changed with MX2004)

t = dateParam.seconds
hr = t/3600 -- 24 hour format
mins = (t/60) - (hr*60)
sec = t mod 60


Then you can format the date string how ever you like. If you're interested, I wrote a script to mimick PHP's date formating
http://www.lingoworkshop.com/code/classes/scripts/dateLib.ls

eg.

d = the systemDate
put GetDateStr("jS of F Y, \a\\t g:i:s a", d)
  --   "28th of February 2005, at 11:43:37 am"



Luke

On 22/09/2005, at 8:13 AM, Kerry Thompson wrote:

Is there a dot-syntax way of getting the year, month, and day? I can get
it by parsing _system.date(), but the year/month/day order depends on
the system's country settings.

Also, is there a way to get the time in 24-hour format? i.e., 17:05:32
instead of 5:05:32 pm?

Cordially,

Kerry Thompson


[To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [email protected] (Problems, email owner- [email protected]). Lingo-L is for learning and helping with programming Lingo. Thanks!]


[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email 
[email protected]  (Problems, email [EMAIL PROTECTED]). Lingo-L is for 
learning and helping with programming Lingo.  Thanks!]

Reply via email to