Author Topic: HMS?  (Read 2513 times)

0 Members and 1 Guest are viewing this topic.

RNilsson

  • Guest
HMS?
on: Sun, 09. February 2003 - 21:08:01
Will future versions of vlibDate include functions for handling hour, minute and seconds?

This to be able to make some finer adjustments and a more precise time for use with scripts (like news and post-scripts) etc and for storage in db.

releasedj

  • Guest
HMS?
Reply #1 on: Mon, 10. February 2003 - 12:24:45
As far as I can see, no. To start messing with time, you have to get messy with things like daylight saving hours which is specific to a location, and I'm not prepared to get into that.

I think if we did, it might degrade the standard of the class, rendering it less useful than it presently is, in my opinion.

Regards,

Kelvin

RNilsson

  • Guest
HMS?
Reply #2 on: Tue, 11. February 2003 - 01:17:57
Ok, then i know.
Tnx.

Offline ClausVB

  • Administrator
  • Hero Member
  • *****
  • Posts: 566
    • Homepage: clausvb.de
HMS?
Reply #3 on: Mon, 21. April 2003 - 15:13:57
I used the following function to get date + HM (using vlibDate):

Code: [Select]
/////
// Rearranges date and time like strftime would do. Uses vlibDate.
// source 2002-06-17 111000 = german example Mon, 17. Jun 2002 - 1117
// @param datetime � db_date --- c_open, c_accept, c_closed ... db_dates = DATETIME
// @return �string � � new_date --- Mon, 17. Jun 2002 - 1117

function format_datedb_date
{
global lang, display_date;

if issetdb_date
{
 �if DEBUG echo br Error Date is not set;
 �// new_date stays null for empty values in the database
}
else
{
 �vlib_lang = substrlang, 0, 2;
 �date = new vlibDatevlib_lang;
 �old_date = explode , db_date;
 �new_date = date-formatDateold_date0, display_date . substrold_date1, 0, 5;
}

return new_date;

/* what happens in this function
* �vlib_lang = substrlang, 0, 2; = vlib_lang = the first 2 chars of �
* �every lang variable english en, deutsch de, espanol es, etc.
* �old_date = explode|...|; = old_date0 = 2002-06-17; �old_date1 = 111000;
* �date-formatDateold_date0,|...|; = Mon, 17. Jun 2002 -
* �substrold_date1, 0, 5; = 1117
*/
}

I hope this will help you.

Regards,
Claus
Last Edit: Sun, 09. January 2005 - 20:17:45 by ClausVB

RNilsson

  • Guest
HMS?
Reply #4 on: Thu, 01. May 2003 - 01:05:43
I already have some functions for handling date>dropBox conversion, and have used that code for time-manipulation.

I would have been nice to have it in vlibDate tho.

Offline ClausVB

  • Administrator
  • Hero Member
  • *****
  • Posts: 566
    • Homepage: clausvb.de
HMS?
Reply #5 on: Sat, 12. February 2005 - 17:19:12
There is a quicker way than the function I found out:

Code: [Select]
tmpl-setvardate_time, date-formatDate
substrrowdate_time, 0, 10, �%a, %d.%m.%Y
. substrrowdate_time, 11, 8;
;
That should work, too.

Regards,
Claus
Last Edit: Sat, 12. February 2005 - 17:19:43 by ClausVB