-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfecha.js
48 lines (33 loc) · 1.11 KB
/
fecha.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
const moment = require('moment');
const colors = require('colors');
const fs = require('fs');
colors.setTheme({
right: ['green', 'bold'],
input: ['grey', 'bold'],
verbose: ['cyan', 'bold', 'underline'],
prompt: 'grey',
info: 'green',
data: 'grey',
help: 'cyan',
warn: 'yellow',
debug: 'blue',
error: ['red', 'bold']
});
moment.locale('es');
module.exports = () => {
//console.log('jajaja: ' + moment().format());
var horaMomentjs = ' a las ' + moment().format("h:mm a");
var fechaMomentjs = moment().format("dddd Do");
var mesMomentjs = ' de ' + moment().format("MMMM");
var añoMomentjs = ' Del ' + moment().format("YYYY");
var fechaDatoshoy = '\n' + `'` + 'precio del dolar a dia de hoy ' + fechaMomentjs + mesMomentjs + añoMomentjs +
horaMomentjs + `',` + '\n';
fs.appendFileSync('datos.csv', fechaDatoshoy, function(err){
if (err) {
console.log('fallo al guardar la fecha del dia!!');
} else {
console.log('fecha del dia guardada!');
}
}
);
}