Function that creates a timestamp in c#

I always use something like the following: public static String GetTimestamp(this DateTime value) { return value.ToString(“yyyyMMddHHmmssfff”); } This will give you a string like 200905211035131468, as the string goes from highest order bits of the timestamp to lowest order simple string sorting in your SQL queries can be used to order by date if you’re … Read more

Plotting time on the independent axis

Update: This answer is outdated since matplotlib version 3.5. The plot function now handles datetime data directly. See https://matplotlib.org/3.5.1/api/_as_gen/matplotlib.pyplot.plot_date.html The use of plot_date is discouraged. This method exists for historic reasons and may be deprecated in the future. datetime-like data should directly be plotted using plot. If you need to plot plain numeric data as … Read more

Add timestamp to named column in Google Spreadsheet onEdit script

You could get the values in your header row, and search for the required header in those values using indexOf(). function onEdit(event) { var timezone = “GMT-4”; var timestamp_format = “yyyy-MM-dd HH:mm:ss”; var sheet = event.source.getActiveSheet(); // note: actRng = the cell being updated var actRng = event.source.getActiveRange(); var index = actRng.getRowIndex(); var headers = … Read more

How to combine year, month, and day columns to single datetime column?

There is an easier way: In [250]: df[‘Date’]=pd.to_datetime(df[[‘year’,’month’,’day’]]) In [251]: df Out[251]: id lat lon year month day Date 0 381 53.3066 -0.54649 2004 1 2 2004-01-02 1 381 53.3066 -0.54649 2004 1 3 2004-01-03 2 381 53.3066 -0.54649 2004 1 4 2004-01-04 from docs: Assembling a datetime from multiple columns of a DataFrame. The … Read more

Importing .csv with timestamp column (dd.mm.yyyy hh.mm.ss) using psql \copy

Have you tried setting the datestyle setting of the server? SET datestyle=”ISO,DMY”; You are using the psql meta-command \copy, which means the input file is local to the client. But it’s still the server who has to coerce the input to matching data-types. More generally, unlike the psql meta-command \copy which invokes COPY on the … Read more

Oracle Convert TIMESTAMP with Timezone to DATE

to_timestamp_tz() function with at time zone clause can be used to convert your string literal to a value of timestamp with time zone data type: SQL> with t1(tm) as( 2 select ‘2013-11-08T10:11:31+02:00’ from dual 3 ) 4 select to_timestamp_tz(tm, ‘yyyy-mm-dd”T”hh24:mi:ss TZH:TZM’) 5 at time zone ‘+4:00’ as this_way 6 , to_timestamp_tz(tm, ‘yyyy-mm-dd”T”hh24:mi:ss TZH:TZM’) 7 at … Read more