Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do I concatenate a date and a time to make a datetim
Message
De
29/01/2004 14:57:11
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
29/01/2004 14:50:48
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00871983
Message ID:
00871987
Vues:
28
This message has been marked as the solution to the initial question of the thread.
>Hi there,
>
>I'm working on an application written in VFP 7.0.
>
>I have a class object form for user input, in which the fields can be set up (at runtime) to accept Date, time, char, or logical data, depending on what my app specifies when the user input form is created using CREATEOBJECT. It's working fine. My problem is that I'm returning a date from one field and a time from another one. The date's type is Date and the time's type is Char. I need to use those values to query data in my FoxPro database, and would like to easily concatenate the date and time to make a valid datetime to use in my query.
>
>Any ideas on a quick way to do this?

I don't know whether this is "quick" enough; or whether there is a better method. But you can create a datetime value with the datetime() function.

Assuming your time is in a format like:
02:15:15

or

 2:15:15 && starts with a space
you might use:
MyDateTimeValue = datetime(year(MyDate), month(MyDate), day(MyDate),;
  val(left(MyTime, 2)), val(substr(MyTime, 4, 2)), val(substr(MyTime, 7, 2)))
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform