help-glpk
[Top][All Lists]

RE: [Help-glpk] Time conversion functions

 From: Meketon, Marc Subject: RE: [Help-glpk] Time conversion functions Date: Thu, 20 Nov 2008 15:20:49 -0500

```Can you add a DayOfWeek(t) which returns a number 0 to 6, with 0=Sunday,
1=Monday, etc.

Personally, I prefer the way that Excel and many other packages model
time:  It is the number of days (as a 64-bit "real" number) from some
base time, so 0.5 represents 12 hours from the base time.  It makes
differences very easy to calculate.

-----Original Message-----
Behalf Of Andrew Makhorin
Sent: Thursday, November 20, 2008 1:08 PM
To: Xypron
Subject: Re: [Help-glpk] Time conversion functions

Hi Xypron,

I propose to add to MathProg the following built-in time functions:

localtime()
Returns the current local calendar time (volatile).

str2time(s, fmt)
Converts the specified character string s to the calendar time using
the format control string fmt.

time2str(t, fmt)
Converts the calendar time t to a character string using the format
control string fmt.

maketime(int year, int month, int day, int hh, int mm, int ss);
Converts the broken-down time to the simple calendar time.

Year(t)
Returns the year number, for example, 2008.

Month(t)
Returns the month number, from 1 to 12.

Day(t)
Returns the day of the month, from 1 to 31.

Hour(t)
Returns the hour, from 0 to 23.

Minute(t)
Returns the minute, from 0 to 59.

Second(t)
Returns the second, from 0 to 59.

NOTE: The calendar time is the number of seconds elapsed since
1970-01-01 00:00:00. It may be positive as well as negative.

Andrew Makhorin

_______________________________________________
Help-glpk mailing list
http://lists.gnu.org/mailman/listinfo/help-glpk
----------------------------------------------------------------------------
This e-mail and any attachments may be confidential or legally privileged.  If
you received this message in error or are not the intended recipient, you
should destroy the e-mail message and any attachments or copies, and you are
prohibited from retaining, distributing, disclosing or using any information
contained herein.  Please inform us of the erroneous delivery by return e-mail.