Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do I convert a date to a strictdate
Message
De
10/02/2000 14:38:44
 
 
À
10/02/2000 11:31:13
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00329655
Message ID:
00330251
Vues:
18
>>>I've got the following date: 01/11/1999
>>>
>>>Is there a function that I can apply to it that will give me as a result: {^1999-11-01} ?
>>>
>>>The reason is that I wan to construct an SQL filter and I dont want to have 01/11/1999 in my construct but {^1999-11-01}.
>>
>>I am curious... why do you want to convert the date to a character in the filter, why not just leave it in a variable?
>
>Because my SELECT statement is going to be constructed from a date in a form. Maybe I should've said that the format of the date in the example that I gave was not static. The format of that date could be in the form DMY MDY or YMD.
>
>Anyway my problem is solved now.
>
>What I did is that I built my SELECT statement with the YEAR MONTH and DAY functions.
>
>'{^' + STR(YEAR(ldDate, 4) + '-' + STR(MONTH(ldDate)) + '-' + STR(DAY(ldDate)) + '}'
>
>
>Don't hesitate to reply if you think that you've go something better.

Always!
oRegExp = CREATEOBJ('Vbscript.RegExp')
oRegExp.pattern = '(\d{2})/(\d{2})/(\d{4})'
oRegExp.global = .t.
? oRegExp.Replace("01/11/1999 29/02/2000 Ed was born on 04/04/1957","{^$3-$2-$1}")
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform