Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Proper syntax for universal date
Message
De
10/04/2003 08:02:22
 
 
À
10/04/2003 04:16:29
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00775886
Message ID:
00775945
Vues:
14
>You can use
>
>YYYY-MM-DD and YYYYMMDD regardless of SET DATEFORMAT
>
>and from BooksOnline
>
>
>Applications using other APIs, or Transact-SQL scripts, stored procedures,
>and triggers should use the unseparated numeric strings for example:
>yyyymmdd as 19980924
>
I have built this function later on last night after I posted this message. I use it in a method which has to generate a SQL which could fit either VFP or client server table.
* Return a date in a universal format
* expD1 Date
* expL1 Pass .T. when generating for a backend
FUNCTION DateUniversal
PARAMETERS tdDate,tlBackend
LOCAL lcDate
lcDate=''

* Client server
IF tlBackend
   lcDate=lcDate+"'"
   lcDate=lcDate+ALLTRIM(STR(MONTH(tdDate)))+'/'+PADL(DAY(tdDate),2,'0')+'/'+PADL(DAY(tdDate),2,'0')
   ELSE
   lcDate=lcDate+'{^'
   lcDate=lcDate+ALLTRIM(STR(YEAR(tdDate)))+'/'+PADL(MONTH(tdDate),2,'0')+'/'+PADL(DAY(tdDate),2,'0')
ENDIF

* If we have a date time
IF TYPE('tdDate')='T'
   lcDate=lcDate+' '+PADL(HOUR(tdDate),2,'0')+':'+PADL(MINUTE(tdDate),2,'0')+':'+PADL(SEC(tdDate),2,'0')
ENDIF

* Client server
IF tlBackend
   lcDate=lcDate+"'"
   ELSE
   lcDate=lcDate+'}'
ENDIF

RETURN lcDate
Is there more consideration I need to verify for?
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform