Time

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
venkycool
Participant
Posts: 59
Joined: Fri Feb 16, 2007 12:24 am
Location: USA

Time

Post by venkycool »

Hi all,

Can anyone let me know the windows command for current time which should show only the HOUR.

for eg: In Unix, the command is date +%H which shows the result as 11 (24 hour format) if the current time is 11:20:36.

I need the same command the get it worked in Windows.

Thanks in advance.
Suriv
No one is perfect... that's why pencils have erasers
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

For an actual DOS command, all I am aware of is time /t and then you'd need to parse out the hour. If we're talking PX with the MKSToolkit then the UNIX commands can be used.
-craig

"You can never have too many knives" -- Logan Nine Fingers
sachin1
Participant
Posts: 325
Joined: Wed May 30, 2007 7:42 am
Location: india

Re: Time

Post by sachin1 »

echo %time:~0,2%

C:\Documents and Settings\s1>echo %time%
22:32:38.65

for above time in 24 hour format, below commad gives the output as 22

C:\Documents and Settings\sabankar>echo %time:~0,2%
22
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Well, that's certainly intuitive. :P
-craig

"You can never have too many knives" -- Logan Nine Fingers
venkycool
Participant
Posts: 59
Joined: Fri Feb 16, 2007 12:24 am
Location: USA

Post by venkycool »

Thanks alot Sachin,

I was using time /t command only. I just had a thought whether we can have only HOUR....You got it for me...

Thanks all....
Suriv
No one is perfect... that's why pencils have erasers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

chulett wrote:Well, that's certainly intuitive. :P
That's why they're called BAT files.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply