timestamp

Set mtime based on date string in filename

旧巷老猫 提交于 2019-12-24 13:26:01
问题 Given a group of files with the following naming convention: datetime_restofname.txt an example of which would be: 200906290700_somewordorphrase.txt how could I batch change the mtime of the files to match the date and time in the filename? 回答1: $ for f in *.txt; do touch -t `echo $f | cut -f1 -d _` "$f"; done This will set the file modtime to the date string before the underscore. 来源: https://stackoverflow.com/questions/1066690/set-mtime-based-on-date-string-in-filename

How to get current timestamp in Android without it updating like a clock

南笙酒味 提交于 2019-12-24 13:17:57
问题 I'm trying to get a timestamp in android, this is my code; public String getTimestamp() { String timestamp = DateFormat.getDateTimeInstance().format(new Date()); return timestamp; } When I create a variable to display the timestamp. Ex) String timestamp = getTimestamp(); This should save the current timestamp as a string. However when I print this string 'timestamp', it continues updating in real time like a clock. I just want the current timestamp. I don't have it in a for loop or anything,

Losing timezone-awareness when saving hyerarchical pandas DatetimeIndex to hdf5 in Python

最后都变了- 提交于 2019-12-24 12:33:54
问题 I'm on pandas 0.14.1. Assume I need to index data by two timestamps in a hierarchical index using timezones. When saving the resulted DataFrame to hdf5 I seem to lose timezone-awareness: import pandas as pd dti1 = pd.DatetimeIndex(start=pd.Timestamp('20000101'), end=pd.Timestamp('20000102'), freq='D', tz='EST5EDT') dti2 = pd.DatetimeIndex(start=pd.Timestamp('20000102'), end=pd.Timestamp('20000103'), freq='D', tz='EST5EDT') mux = pd.MultiIndex.from_arrays([dti1, dti2]) df = pd.DataFrame(0,

VBA how to store timestamp in variable

倾然丶 夕夏残阳落幕 提交于 2019-12-24 10:02:10
问题 I am working on processing of log or history file. In column 1 there is timestamp like this Wed Mar 01 22:08:01 EST 2017. I am copying the entire contents of the sheet into 2d variant array for further processing. Now I want to store this timestamp as date or datetime to further process it. but if I do dim dTimeStamp as date and in the loop use it to store the value of column1 dTimeStamp = cdate(vbaseArray(I,1)) it gives me typemismatch error. Is there a way I can store timestamp value as

DateTime.UtcNow is 4 hours ahead

为君一笑 提交于 2019-12-24 07:58:52
问题 I have seen some answers about how to correct this. I have an object of type DateTime. I have assigned this object as shown below. obj.TimeStamp = DateTime.UtcNow; I cannot seem to find the right combination or code manipulation to get the correct date and time. It is always exactly 4 hours ahead of what the current time is. This software will be deployed in various timezones. Is there any reliable way to ensure the timestamp will be accurate across all time zones. My server time settings are

How to get the timestamp range of this hour?

和自甴很熟 提交于 2019-12-24 07:39:05
问题 How to get the UNIX timestamp range of the current hour, i mean one of the first second and the other for the last second. so if it's 18:45 i would get the timestamp of 18:00 and 18:59. Thanks 回答1: You can get the components of the current time with getdate() , and use mktime() to find the timestamps: $date = getdate(); $start = mktime($date['hours'], 0, 0); $end = $start + (60*60); You can also use date() , which is slightly simpler: $start = mktime(date("H"), 0, 0); $end = $start + (60*60);

Getting the timestamp of a file using PL/SQL

倖福魔咒の 提交于 2019-12-24 07:32:28
问题 I am trying to get the timestamp of a text file abc.txt in some directory XYZ in oracle server. This file can get updated at any time in the day and i have to check if the file was updated any time after yesterday midnight, if yes i need to email that file as an attachment. Is there any other way i can check this? I have searched a lot over internet but could not find the solution. Seriously not getting a clue of how to get it done. It would be great if anyone could guide me. Thanks. 回答1: I

# How to use the DateTime class (Dealing with Conversions, Formatting, Diffs, and Time zones) [duplicate]

戏子无情 提交于 2019-12-24 06:47:43
问题 This question already has answers here : Convert one date format into another in PHP (15 answers) How to calculate the difference between two dates using PHP? (32 answers) Timezone conversion in php (8 answers) Adding three months to a date in PHP (10 answers) Closed 11 months ago . Everyone has to deal with date/time formatting, time zones, weird time formats, etc. at some point in programming. PHP has few ways to deal with these problems, the most notable of which is PHP's built in DateTime

Force Eloquent Models to output all timestamps as long

佐手、 提交于 2019-12-24 06:41:15
问题 I'm working on a backend using Eloquent Models. In order to set a default way to output dates, I'm looking for a way to tell the Eloquent Model to output its date attributes as a long (unix-timestamp). $user = User:find(id); echo $user->toJson(); // the current output { "id":1, "username":"root", "created_at":"2016-12-25 18:23:34", "updated_at":"2016-12-25 18:23:34" } // the desired output { "id":1, "username":"root", "created_at":1482690214, "updated_at":1482690214 } Is there a clean way to

How to create a RAR archive with date of the archived folder in archive file name?

妖精的绣舞 提交于 2019-12-24 05:41:10
问题 The cloud service Dropbox used by me does not preserve the original time stamp of uploaded folders. I have to use the WinRAR to compress the folder to backup in the cloud to keep the original folder date/time before I upload it to Dropbox. But I could not find an easy way to create the archive file name with the current last modification date of the folder in format YYYYMMDD in file name of archive file. The command line for %I in ("d:\doc\aatmp") do @echo %~tI executed in a command prompt