Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

combine time and date into variable

Status
Not open for further replies.

inteleserve

IS-IT--Management
Dec 13, 2002
75
US
How can I get a variable to equal the time combined with tht date.

vartimedate = vartime & vardate
vartimedate = time() & date()

End with something like this:

12355603082004

for this time and date

12:35:56 03/08/04
 
ld = DATETIME()
? ld


Walid Magd
Engwam@Hotmail.com
 
inteleserve,

Is it something like this?

cTime = time()
cDate = dtoc(date())
? chrtran(cTime + cDate, ':/-', '')


-- AirCon --
 
Well I guess all I need to to is convert the time and date into numbers or characters without "/" or ":".

Can you show me how to do this?
 
Have you run the code I posted ?


-- AirCon --
 
Try: TTOC(DATETIME(),1)

Of course, this will be formatted YYYYMMDDhhmmss
so that it sorts properly, where your example would sort all times of the same hour together, regardless of date.
 
wgcs,

datetime() does not work, i am using the unix version so maybe thats why....


aircon

cTime = time()
cDate = dtoc(date())
? chrtran(cTime + cDate, ':/-', '')

is not working...........
 
Aha! That makes a big difference. Then you're on VFP3 for Unix, and Datetime() was introduced in VFP6.

AirCon's suggestion should work, unless TIME() is a new function too... what do you get when you run his code? An error? what is displayed by:
?TIME()
?DATE()
?DTOC(DATE())
 
inteleserve said:
i am using the unix version so maybe thats why....

Arrgghh... I didn't think about that :-D


-- AirCon --
 
it works nevermind...........I had a brain fart....dam im retarded.....


thanks

Erin.

 
Ok ... tons of posts.. I got it now

ctime = time()
cdate = dtoc(date())
cdatetime = chrtran(ctime + cdate, ':/','')

AirCon - your post help me out tons... thanks

yeah .. datetime() does not exist on this old unix version.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top