如何获得下一个7天的名字来自时间戳

时间:2018-04-17 20:38:34

标签: angular timestamp

我,我希望在DATE的那个星期显示可用的预约表。 这是我的组件

import { Component, OnInit } from '@angular/core';
import { CalendarModel } from '../calendar-model';

@Component({
  selector: 'app-semaine',
  templateUrl: './semaine.component.html',
  styleUrls: ['./semaine.component.css']
})

export class SemaineComponent implements OnInit {

  startSemaine;//en timestamp

  constructor(private _calendar:CalendarModel) { 
    this.startSemaine = this._calendar.getDateMinSec(Date.now());
    this.getNameDay();
  }

  getNameDay(){
    console.log(this.startSemaine);
      //get name day 

  }

  calculNext7Day(){
    //calcul for 7 day
  }

  perHourDay(){
    //show hour journey 1H + N
  }
  
  ngOnInit() {
  }

}

我使用时间戳,我怎么能得到名字日?我希望第二天在开始的日子里显示简单的7:

mardi(现为1523994732)| mercredi | jeudi | vendrdi | samedi | dimanche | Lundi将军

我现在使用this.startSemaine获得时间戳,我计算第二天是

next = now + 60 * 60 * 24

开始我的片段,我现在怎么不能得到名字? 谢谢你回复我

2 个答案:

答案 0 :(得分:2)

您将获得当天的名字:

var curdate = new Date(null);
curdate.setTime(timestamp *1000);   // here timestamp  = 1523994732
var i = curdate.getDay()
var days = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']; //name of the Days
var nameDay = days[i]

enter image description here

答案 1 :(得分:0)

是的,我发现了:



function set-domparams {
Param(
    [Parameter(Mandatory = $true,Position=0)]
    [string]$domain,
    [Parameter(Mandatory = $true,Position=1)]
    [string[]]$username,
    [Alias("pass","p")]
    [Parameter(Mandatory = $false,Position=2)]
    $password,
    [Parameter(Mandatory = $true,Position=3)]
    [ValidateSet("Y","N")]
    [string]$cyberArk
)

function Get-Creds($domain,$user,$password) {
    Invoke-Expression -Command:'cmd.exe /c klist purge' | Out-Null
    If (!($password)) {$password = Read-Host "Enter $domain password" -AsSecureString}
          $creds = new-object -typename System.Management.Automation.PSCredential -argumentlist $user,$password      
          return $creds
    }

$doms = @{
    'domain1.com' = @{'serverDC' = "somesvalidDC.fqdn.com";'searchBase' = "DC=somesvalidDC,DC=fqdn,DC=com";'suffix' = "domain1.com"; 'TSMserver' = "127.0.0.1"; 'NetBIOS' = "domain1"; 'SCOM' = "somescomserver.com";'AdminSuffix' = "_admin"}
    'domain2.com' = @{'serverDC' = "somesvalidDC.fqdn.com";'searchBase' = "DC=somesvalidDC,DC=fqdn,DC=com";'suffix' = "domain2.com"; 'TSMserver' = "127.0.0.1"; 'NetBIOS' = "domain2"; 'SCOM' = "somescomserver.com";'AdminSuffix' = ".adm"}
}

$global:adminsuffix = $doms.$domain.AdminSuffix
$global:dc = $doms.$domain.serverDC
$global:DomNBT = $doms.$domain.NetBIOS
$global:searchbase = $doms.$domain.searchBase
$global:suffix = $doms.$domain.suffix
$global:TSMserver = $doms.$domain.TSMserver
$global:scom = $doms.$domain.scom

If ((!$cyberArk) -or ($cyberArk -eq 'N')) {

    $global:user = $doms.$domain.NetBIOS + "\" + $username + $adminsuffix
    $global:fetchCreds = Get-Creds -domain $domain -user $user -password $password

}

Else {

    $global:User = "corpau\" + $username 
    $CyberArkdomain = 'corpau.wbcau.westpac.com.au'
    $global:fetchCreds = Get-Creds -domain $CyberArkdomain -user $user -password $password

}