I am new to batch programming.I have a requirment to change

December 4, 2014 at 22:13:33
Specs: Windows 7
I am new to batch programming.I have a requirment to change date format using batch file. I have a field name called createdDate and Lastlogindate which is in format "2013-12-02T02:48:33.000Z"

See More: I am new to batch programming.I have a requirment to change

Report •


#1
December 4, 2014 at 23:00:00
There is no output-format specified. A context background of the file content will also be needed (ie: a typical sample, what kind of stuff we need to extract this date-field from).

Report •

#2
December 5, 2014 at 01:56:01
Hi ,

Thanks for the reply!

I have a field name called createdDate and Lastlogindate which is in format "2013-12-02T02:48:33.000Z"
But as per the requirment date format should be "12/2/2013 14:57"

Or is there any way to skip the character from T********Z and to replace "-" to "/"

could you please help!!!!!


Report •

#3
December 5, 2014 at 21:37:00
well, half is better than none Ha ha! (Still no source-file context sample! Here's this field name, but no context of the line (or binary stream) in which it is embedded.
I have a field name called createdDate and Lastlogindate which is in format "2013-12-02T02:48:33.000Z"
But as per the requirment date format should be "12/2/2013 14:57"
Or is there any way to skip the character from T********Z and to replace "-" to "/"
::==
yes, but replacing / with - won't achieve your aim, because the order is still m-d-y
mechanics is simple for date:
for /f "tokens=1-5 delims=-T:" %%a in ("%lastlogindate%") do set out=%%b/%%c/%%a
except for the leading zero in days and months. Not dealing with the time yet, waiting for the proverbial shoe to drop...


Report •

Related Solutions

#4
December 8, 2014 at 09:49:22
Be warned, nbrane. There may be some date/time calculation involved. That's ISO 8601, and the "Z" ending denotes UTC. If the OP wants local time, you're probably better off feeding it to PowerShell, which does recognize the string and will automatically do the conversion. Sadly, VBScript does not.

How To Ask Questions The Smart Way

message edited by Razor2.3


Report •


Ask Question