Hot answers tagged

51

Usually you'll want to have the time set automatically, and in that case, you'll want to set up ntpd to automatically set the time for you. The specifics differ slightly from distribution to distribution, but if you're running Ubuntu, for instance, there's a guide on setting up NTP on Ubuntu. Otherwise, just Google ntpd <distribution-name>, and ...


36

As described in Microsoft KB 214058: Days of the week before March 1, 1900 are incorrect in Excel MORE INFORMATION When the date system in Microsoft Excel was originally created, it was designed to be fully compatible with date systems used by other spreadsheet programs. However, in this date system, the year 1900 is incorrectly ...


23

You can do this with date +%s For more possibilities, see man date


19

Just use the date command with -d option: $ date -d "1983-08-04 348 days" Tue Jul 17 00:00:00 BST 1984 You can change the output format if you want: $ date -d "1983-08-04 2 days" +%Y-%m-%d 1983-08-06


18

Set the Hardware Clock to the current System Time. # hwclock --systohc Set the System Time from the Hardware Clock. # hwclock --hctosys


17

What you want is to use a custom format. Just type it in the box. Click for full size


17

You can easily do it with VLOOKUP, just insert a new column with column numbers, then use this formula: =VLOOKUP(MONTH(E2),A:C,3,FALSE)


16

Yes. You can even do it over a LAN. The CIFS transaction is TRANS2_QFSINFO and the information level is SMB_QUERY_FS_VOLUME_INFO. The native Windows NT API function for querying a volume's creation time is ZwQueryVolumeInformationFile(), which yields a FILE_FS_VOLUME_INFORMATION data structure (almost identical to the CIFS one, note) when asked for the ...


16

You'll need to do string parsing, then pass an appropriate formatted value into DATEVALUE – something like this: =DATEVALUE(RIGHT(A1,2)&"-"&MID(A1,6,3)&"-"&LEFT(A1,4)) (edit: updated formula - tested and it works for me on one example - may need to refine depending on your input)


15

I kept experimenting till I figured out that vim was expanding the "%" character. So just escape "\%" and every thing works as I expected. :r!date "+\%F" 2012-07-20 Now I can put dates into files Like I would like to :r!date "+\%F" -d "-2 day" 2012-07-18


15

It's 6pm in Taipei, what time is it here? date --date='TZ="Asia/Taipei" 18:00' Fri Jul 16 11:00:00 BST 2010 At 11am here in London, what time is it in Taipei? TZ=Asia/Taipei date -d "11:00 BST" Fri Jul 16 18:00:00 CST 2010


15

=TODAY() + 7*12 or in general, =TODAY() + 7*(no of weeks)


15

The problem: Excel does not want to recognize dates as dates, even though through "Format cells - Number - Custom" you are explicitly trying to tell it these are dates by "mm/dd/yyyy". As you know; when excel has recognized something as a date, it further stores this as a number - such as "41004" but displays as date according to format you specify. To add ...


14

Make sure you have not changed your taskbar to use small icons only. This removes the date from the taskbar and only shows the time. Right Click Taskbar Properties Use small icons


13

I had absolutely no luck with the up-voted Skinny Clock utility. Instead I tried "TClock", which was mentioned in a side conversation as not being compatible with Windows 7 circa 2009. Apparently we didn't have long to wait- in 2010 an update was released that is fully compatible with Windows 2000/XP/2003/Vista/2008/7 32 & 64 bit. TClock 2010 works ...


13

In order to do what you are looking for, a simple script (as @Ignacio pointed out) should do the trick: while true do echo "$(date '+TIME:%H:%M:%S') $(ps aux | grep "pattern" | wc -l)" | tee -a logfile sleep 2 done I use tee instead of >> so that you can see the output on your terminal as well as capture it in your log.


12

This can easily be done using watch too without using any scripts. watch -t -n 10 "(date '+TIME:%H:%M:%S' ; ps aux | grep "pattern" | wc -l) | tee -a logfile"


12

IMHO you are making something simple needlessly complex. Why not just do something simple like. NEWDIR=$(date -R);mkdir "$NEWDIR";cd "$NEWDIR"


12

The only way I can think of is to change the date format. Open Control Panel->Clock, Language, Region->Change the date, time, or number format->Additional Settings...->Date tab Prepend dddd to the Short date: format You'll then see the day name in the tray clock. Of course, this will change the short date format throughout the OS, which may or may ...


11

If the date cells are all in one column, here's a quick and dirty way: Assuming the dates are in A1 downwards, insert two columns to the right. In B1, put the formula: =DATE(YEAR(A1)-4,MONTH(A1), DAY(A1)) Copy this formula down the column to recalculate all the dates from column A. Now select and 'copy' column B (the new dates) and use 'paste as ...


11

This Bash function works for me on a GNU-based system: jul () { date -d "$1-01-01 +$2 days -1 day" "+%Y%m%d"; } Some examples: $ y=2011; od=0; for d in {-4..4} 59 60 {364..366} 425 426; do (( d > od + 1)) && echo; printf "%3s " $d; jul $y $d; od=$d; done -4 20101227 -3 20101228 -2 20101229 -1 20101230 0 20101231 1 20110101 2 20110102 ...


11

tar cfz backup-$(date +%Y-%m-%d).tar.gz ... man strftime or man date to see what %-escapes can be used with date.


11

The problem is not how you can use date to output what you want... your problem is: This way I'd like to get the old logfiles out of my way, but still have 5-6 days of logfiles around. So, why not using find to remove all files but this week's? find /path/to/files/ -mtime +7 -exec rm {} \; In addition, date has many different implementations - I ...


11

Handles leap years: @echo off & setlocal set year=%1 if "%year%"=="" set /p year=Year? if "%year%"=="" goto :eof set /a mod=year %% 400 if %mod%==0 set leap=1 && goto :mkyear set /a mod=year %% 100 if %mod%==0 set leap=0 && goto :mkyear set /a mod=year %% 4 if %mod%==0 set leap=1 && goto :mkyear set leap=0 :mkyear call :mkmonth ...


10

I've actually figured this one out, here is the answer: =(C2 - DATEVALUE("1/1/1970"))*86400


10

Vim has an internal strftime() function. Try this (in insert mode): <C-r>=strftime('%F')<CR>


9

For Excel 2010, rather than opening your CSV file, create a new workbook, then on the DATA tab, select Get External Data → From Text. This gets to the interface where you can specify how to interpret your text data, including how to handle dates.


9

Here is the reason explained by Joel himself: My First BillG Review Basic uses December 31, 1899 as the epoch instead of January 1, 1900, but for some reason, today's date was the same in Excel as it was in Basic. Huh? I went to find an Excel developer who was old enough to remember why. Ed Fries seemed to know the answer. "Oh," he ...


8

Your code works fine for me. Although I have to use B1 : =TEXT(A1,"dd.mm.yyyy") B2 : =TEXT(A2,"dd mm yyyy") I am guessing the reason I use , instead of ; is due to the difference of language. The fault is more likely to be due to dd.mm.yyyy For example, I know in Germany, I can't use dd because d (day) in German is tag, and as such it requires tt ...


8

There is no "volume creation date" that I know of built-in to NTFS. However, you should be able to approximate the creation date quite closely by looking at the creation date of the System Volume Information directory in the root of the volume.



Only top voted, non community-wiki answers of a minimum length are eligible