0

I have a file which gets created/modified on a PST machine. But when I am accessing this file from an Indian standard time, the Modified date will be returned according to the current system time zone. (As explained here) Is there any way I can get this date with respect to the time zone provided

var WshShell = Sys.OleObject("WScript.Shell");
var fso = new ActiveXObject("Scripting.FileSystemObject");           
var objFile = fso.GetFile("c:\\abc.txt");
var date = objFile.DateLastModified + "";
Community
  • 1
  • 1
satya
  • 2,537
  • 9
  • 33
  • 43

1 Answers1

0

Yes, you do this with the DateDiff function in VBS:

http://www.devguru.com/technologies/vbscript/quickref/datediff.html

DevGuru Info

DateDiff(Interval, Date1, Date2, FirstDayofWeek, FirstWeekofYear)

The DateDiff function calculates the amount of time between two different dates.
There are three mandatory arguments.

Interval

The Interval argument defines the the type of time interval you wish to use to
calculate the time difference.

Only the following settings can be used. You must place the setting inside a
pair of double quotes.   

| SETTING | DESCRIPTION  |
|:--------|:-------------|
| YYYY    | Year         |
| Q       | Quarter      |
| M       | Month        |
| Y       | Day Of Year  |
| D       | Day          |
| W       | WeekDay      |
| WW      | Week Of Year |
| H       | Hour         |
| N       | Minute       |
| S       | Second       |

In javascript you can do it like this:

How to calculate date difference in javascript

Community
  • 1
  • 1
Nathan Rice
  • 3,091
  • 1
  • 20
  • 30
  • 1
    Thank you. though this is not what I am exactly looking for, this would help in getting a solution – satya Feb 15 '12 at 07:25
  • 1
    Nathan - Might be an idea to copy a portion of that devguru.com page contents into your answer, so that your answer doesn't become unhelpful in the case of links dying. Others - In the meantime, try http://web.archive.org/web/20121225140115/http://www.devguru.com/technologies/vbscript/quickref/datediff.html – user66001 Aug 14 '14 at 06:06
  • Two things, stackoverflow is a wiki, anyone can update it. So in the future you can just do this kind of thing yourself. Secondly, I went ahead and updated it anyway. – Nathan Rice Aug 14 '14 at 16:33