Hot answers tagged

54

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 ...


28

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


23

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


20

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 ...


18

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


18

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


18

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


17

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)


17

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 ...


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

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


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

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 ...


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

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


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

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


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 ...


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 ...


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

just ntpdate ntp.ubuntu.com and everything will be fine.


8

Another common, very annoying problem is, when the wrong timezone is selected... Check the timezone with the date output: $ date Fre Aug 23 18:47:04 UTC 2013 To correct the timezone type: $ sudo tzselect and select the correct Region with the corresponding numbers. A second task is to set the correct time: $ sudo date --set="18:37:00" ...


8

The normal way is to set your timezone. There are a bunch of files stored by region in the following directory: /usr/share/zoneinfo Take a look and find the one which matches your region. Then you have to create a symlink from /etc/localtime: sudo rm /etc/localtime sudo ln -s /usr/share/zoneinfo/Europe/London /etc/localtime


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.


8

=edate(a1;1) edate returns the date that is the specified number of months after or before the specified date. First argument of edate :start date. Second argument of edate : number of month. If negative, edate calculates the date before.



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