Hot answers tagged date
14
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 ...
13
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
11
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)
9
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 ...
8
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 ...
8
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 ...
8
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
...
7
You can use SetFile on the command line to do this however it is not included by default in Mac OS X 10.4.x (Tiger). If you have installed the Developer Tools or most of the Combo updates it is installed but in a non standard location. SetFile was included in /usr/bin/ for Mac OS X 10.5 and later.
To find the command you can try using locate to find the ...
6
It's not necessarily going to speed up time, but it can be useful for debugging.
Nirsoft's RunAsDate
From the site:
RunAsDate is a small utility that allows you to run a program in the date and time that you specify. This utility doesn't change the current system date and time of your computer, but it only injects the date/time that you specify into ...
6
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 ...
6
The problem is that ` marks are used to denote commands who's output should be substituted in your command... so your command is actually three commands:
"echo " (contained in the first set of 1 marks)
"-1308741881 | bc" (contained in the second set of 1 marks)
find . -mtime -OUTPUT FROM COMMAND #1date +%sOUTPUT FROM COMMAND #2
Command #1 outputs ...
6
The future-dated entries are not in fact your most recent.
They just happen to be at the top because at one stage, your computer did think it was later this year.
62985605 seconds equates to exactly 729 days. So on or around 11/09/2010, your computer thought it was 2012 (I don't know if this is MM/DD or DD/MM hence my "on or around").
6
They are Unix Epoch millisecond date/time stamps. Here is one converter or you could always write your own. Basically it is the number of milliseconds since 1/1/1970 not counting leap seconds.
Assuming you have a UNIX shell handy, they can be converted to any format using the date tool with the argument --date=${epoch_time}, for example:
$ date ...
5
Right click the Date field button.
Choose Group and Show Detail | Group
In the Grouping dialog box, select Days from the 'By' list.
For 'Number of days', select 7
The week range is determined by the date in the 'Starting at' box, so adjust this if necessary. In the example below, December 29, 2003 (a Monday), was entered as the starting date.
Click OK
...
5
You don't happen to double-click the clock to get the calendar up to check on dates?
I used to do this all the time, and if you scroll months (say, to check a date in September) and then accidentally hit OK instead of Cancel - you overwrite the system time.
Luckly, Win7 changed the behaviour so you can click the clock to get a read-only calendar up.
4
Here's something I found with a quick search:
Generically you can get the nth xday of the month with this formula
=DATE(B2,A2,1+7*n)-WEEKDAY(DATE(B2,A2,8-xday))
where year is in B2 and month (as a number 1 to 12) is in A2, and where xday is a number representing the day of the week (1 = Sun through to 7 = Sat), so for 1st Saturday that becomes
...
4
Yes, there is -- you need to sync your system time with the external time servers. A high-end solution is to run ntp, a simpler solution is to just call ntpclient, or ntpdate.
Watch out that because too many Linux machines were hitting the same time servers, there are now some per-distro wrappers. E.g. on an Ubuntu machine here I have this in /etc/crontab:
...
4
You need to change the timezone.
To do it system-wide, symlink /etc/localtime to the apropriate file in /usr/share/zoneinfo. For example:
ln -sf /usr/share/zoneinfo/Europe/Paris /etc/localtime
In CentOS, you might need to also edit /etc/sysconfig/clock.
To change the timezone just for the current user, set $TZ instead:
export TZ="Europe/Paris"
...
4
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
4
watch is an ncurses program, and is designed to be run in a console window (not redirected), which is why it's creating a bunch of unprintable characters (those are the control characters that manage and move the cursor around for redrawing the screen).
You might try moving the date / grep commands into a script, and then call that script from a cronjob.
4
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.
4
If you entered either of the values you give, the cell doesn't contain a date, it contains a string. You can't change as string just by changing the format!
Excel tries to guess your data type, and that can be really confusing. If you enter some kind of data with an obvious type (date, time, date/time, number) it can figure that out. If the type isn't ...
4
--date is not a conventional date option on many unix systems.
If you have a wide variety of UNIX/linux-like platforms to work with, try to examine the man page for date (1) on each of them (if man pages are installed) and see what date options are common to all of them as a starting point.
You might find date -v (adjust) reasonably portable.
Something ...
3
The + set the output format only. You need to pre-format your string is you want to use the -s option (either by modifying your program or by using e.g. sed).
In your case, you can pipe the result of your program in this:
sed -e "s/\(..\)\(..\)\(..\)/\\3\\2\\1/"
3
Another method, without escaping, using system():
system('date +%F')
In INSERT mode:
<C-r>=system('date +%F')<CR>
In NORMAL mode:
:put=system('date +%F')<CR>
3
The following will display the dates for Monday, Wednesday and Friday of the current week:
=NOW() - WEEKDAY(NOW(),3)
=NOW() - WEEKDAY(NOW(),3)+2
=NOW() - WEEKDAY(NOW(),3)+4
Basically this is taking the time now, and subtracting the current weekday (which gives you Monday), then adds 2 days or 4 days to get Wednesday and Friday.
3
Your Mid(strInput, intPosition, intDateLength) isn't working for you. For 9/1/2011, you're matching DateFormat(6) = "*#[-/]#[-/]##*". So Mid(strInput, intPosition, intDateLength) = Mid("9/1/2011", 1, 6) and returns "9/1/20" rather than "9/1/2011".
based on your example above, I think you need to add 2 more patterns so that you cover all combinations of 1 ...
3
Here is a batch file that addresses exactly this problem:
http://ss64.com/nt/syntax-getdate.html
The trick is that they look what DATE says in which format you need to input the date:
The current date is: Fri 29/07/2011
Enter the new date: (dd-mm-yy)
Based on this information, they parse the extracted date differently.
3
1970/1/1 is the Unix epoch start time, see http://en.wikipedia.org/wiki/Unix_time .
Unix and Linux systems count the time in seconds starting at 1970/1/1, probably, when no date has been set at all in the mail headers, this starting time is set by default by the MTA or showed by default by your mail client.
3
Can't be done in just Bash, but if you have Perl:
use POSIX;
my ($jday, $year) = (100, 2011);
# Unix time in seconds since Jan 1st 1970
my $time = mktime(0,0,0, $jday, 0, $year-1900);
# same thing as a list that we can use for date/time formatting
my @tm = localtime $time;
my $yyyymmdd = strftime "%Y%m%d", @tm;
Only top voted, non community-wiki answers of a minimum length are eligible
