Vbscript 如何在Jscript中获取文件相对于特定时区的文件修改日期?

Vbscript 如何在Jscript中获取文件相对于特定时区的文件修改日期?,vbscript,timezone,wmi,jscript,Vbscript,Timezone,Wmi,Jscript,我有一个在PST机器上创建/修改的文件。但当我从印度标准时间访问此文件时,修改后的日期将根据当前系统时区返回。(如前所述)我有没有办法得到关于所提供时区的日期 var WshShell = Sys.OleObject("WScript.Shell"); var fso = new ActiveXObject("Scripting.FileSystemObject"); var objFile = fso.GetFile("c:\\abc.txt"); var date =

我有一个在PST机器上创建/修改的文件。但当我从印度标准时间访问此文件时,修改后的日期将根据当前系统时区返回。(如前所述)我有没有办法得到关于所提供时区的日期

var WshShell = Sys.OleObject("WScript.Shell");
var fso = new ActiveXObject("Scripting.FileSystemObject");           
var objFile = fso.GetFile("c:\\abc.txt");
var date = objFile.DateLastModified + "";

是的,您可以使用VBS中的DateDiff函数执行此操作:

DevGuru信息

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       |
在javascript中,您可以这样做:


谢谢。虽然这并不是我想要的,但这将有助于找到解决方案Nathan——也许可以将devguru.com页面内容的一部分复制到您的答案中,这样在链接消失的情况下,您的答案不会变得毫无帮助。其他-同时,尝试两件事,stackoverflow是一个wiki,任何人都可以更新它。所以将来你可以自己做这件事。其次,我还是继续更新了它。