File dates

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

KDJ
Posts: 243
Joined: Mon Sep 05, 2016 3:04 am
Location: Poland

Re: File dates

Post by KDJ »

Templar

To extract date part from a timestamp you can use hb_TtoD function:
dCreate := hb_TtoD(tCreate)
User avatar
mustafa
Posts: 1175
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Contact:

Re: File dates

Post by mustafa »

For the date to come out well --> dd.mm.yyyy
did this occur to me?
Greetings to Master KDJ

Code: Select all


 SET DATE GERMAN
 SET CENTURY ON
 SET CODEPAGE TO UNICODE
....
 IF ! oFolder:IsRootFolder
      tCreated := oFolder:DateCreated

     dCreate := hb_TtoD(tCreated)       // <---  KDJ solution

                Pro1DiaS   :=  SUBSTR( hb_TStoStr(tCreated) ,9,2 )  
                Pro1MESX  :=  SUBSTR( hb_TStoStr(tCreated) ,6,2 )  
		Pro1ANYO :=  SUBSTR( hb_TStoStr(tCreated) ,1,4 )            
		
		Atox1    :=   Pro1DiaS +"."+ Pro1MESX +"."+ Pro1ANYO    // Fecha Correctas 
                Atox2    :=   SUBSTR(  hb_TStoStr(tCreated) ,12,8 ) 
     
       MsgBox( dCreate )   //  <---  KDJ solution       
       MsgBox("Folder:" + CRLF + CRLF + cFolder + CRLF + CRLF + "has been created: "+ Atox1 + SPACE(1) + Atox2  , "Success")
  *    MsgBox("Folder:" + CRLF + cFolder + CRLF + CRLF + "has been created: " + hb_TStoStr(tCreated) , "Success")
    ELSE
.......

PD: Best solution: the contribution of the Master KDJ :idea: ;)

Regards
Mustafa
Templar
Posts: 51
Joined: Sun Apr 01, 2018 5:37 pm
DBs Used: DBF

Re: File dates

Post by Templar »

Ah but where is " hb_TtoD" ? It's not in the standard library!
edk
Posts: 999
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: File dates

Post by edk »

Templar wrote: Thu Apr 30, 2020 8:41 pm Ah but where is " hb_TtoD" ? It's not in the standard library!
https://github.com/Petewg/harbour-core/ ... y-category
https://github.com/Petewg/harbour-core/wiki/Date-Time
User avatar
serge_girard
Posts: 3364
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: File dates

Post by serge_girard »

Harbour is so extended, one cannot remember all !
There's nothing you can do that can't be done...
Templar
Posts: 51
Joined: Sun Apr 01, 2018 5:37 pm
DBs Used: DBF

Re: File dates

Post by Templar »

Right, thanks for that; got it sorted finally!!
Templar
Post Reply